From: Anna Sobiepanek Date: Thu, 24 Feb 2011 21:03:37 +0000 (-0500) Subject: Merge commit 'scott/297' into 0.4 X-Git-Tag: v0.4~32 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=b50c0e55caec10d0d533cfdc11374ad5414e7e25;p=popcorn-js.git Merge commit 'scott/297' into 0.4 Conflicts: popcorn.js --- b50c0e55caec10d0d533cfdc11374ad5414e7e25 diff --cc popcorn.js index 75e3b04,d80b53a..3765619 --- a/popcorn.js +++ b/popcorn.js @@@ -807,14 -825,15 +813,15 @@@ 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; @@@ -845,12 -867,12 +855,12 @@@ // 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; }; @@@ -1074,28 -1046,23 +1084,23 @@@ 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 ] ); } }); diff --cc test/popcorn.unit.js index 85ea387,0ca2c0c..4ec2a06 mode 100755,100644..100755 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js