]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Merge commit 'scott/297' into 0.4
authorAnna Sobiepanek <annaopensource@gmail.com>
Thu, 24 Feb 2011 21:03:37 +0000 (16:03 -0500)
committerAnna Sobiepanek <annaopensource@gmail.com>
Thu, 24 Feb 2011 21:03:37 +0000 (16:03 -0500)
Conflicts:
popcorn.js

1  2 
popcorn.js
test/popcorn.unit.js

diff --cc popcorn.js
index 75e3b04d4c8bebdc24b2c06740b6950ea2089c8c,d80b53ae23fa5f16a31e32d042af4f4cffe7029b..3765619444c29a9b4090e0a745416d1b428b9111
  
        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 ] );
  
              }
            });
index 85ea387830a213c72473e75525f52bcc43902424,0ca2c0caba21fffb6aac6dbfafec7387693a5d53..4ec2a06e65a5bf6b2c580db56bfdc59df0497077
mode 100755,100644..100755