Popcorn.xhr({
url: filename,
+ dataType: type,
success: function( data ) {
- var tracksObject = definition( data ),
- tracksData,
- tracksDataLen,
- tracksDef,
+ var tracksObject = definition( data ),
+ tracksData,
+ tracksDataLen,
+ tracksDef,
idx = 0;
-
+
tracksData = tracksObject.data || [];
tracksDataLen = tracksData.length;
tracksDef = null;
// Assign new named definition
parser[ name ] = parseFn;
-
+
// Extend Popcorn.p with new named definition
Popcorn.extend( Popcorn.p, parser );
-
+
// keys the function name by filetype extension
- Popcorn.parsers[ type ] = name;
+ //Popcorn.parsers[ name ] = true;
return parser;
};
Popcorn.forEach( dataSources, function ( source ) {
- dataTemp = source.split( ":" );
+ // split the parser and data as parser:file
+ data = source.split( ":" );
- dataType = dataTemp[0];
-
- if ( dataTemp.length === 1 ) {
-
- dataTemp = source.split( "." );
-
- dataType = dataTemp[ dataTemp.length - 1 ];
+ // if no parser is defined for the file, assume "parse" + file extension
+ if ( data.length === 1 ) {
-
+ data = source.split( "." );
+ data[ 0 ] = "parse" + data[ data.length - 1 ].toUpperCase();
+ data[ 1 ] = source;
++
}
- dataType = dataType.toUpperCase();
-
- parserFn = "parse" + dataType;
-
// If the video has data sources and the correct parser is registered, continue to load
- if ( dataSources && Popcorn.parsers[ dataType ] ) {
+ if ( dataSources[ 0 ] && popcornVideo[ data[ 0 ] ] ) {
// Set up the video and load in the datasources
- popcornVideo[ parserFn ]( source );
-
+ popcornVideo[ data[ 0 ] ]( data[ 1 ] );
}
});