]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#266] Fixed 'data-timeline-sources' is null bug
authorrwldrn <waldron.rick@gmail.com>
Mon, 17 Jan 2011 20:25:45 +0000 (15:25 -0500)
committerrwldrn <waldron.rick@gmail.com>
Mon, 17 Jan 2011 20:25:45 +0000 (15:25 -0500)
popcorn.js

index 9079278e82900a8a662793b1e09445ead8d65a90..c6953e71923a5c3f821469682de2d83883a57ed0 100644 (file)
     Popcorn.forEach( videos, function ( iter, key ) {
 
       var video = videos[ key ],
+          hasDataSources = false, 
           dataSources, dataTemp, dataType, parserFn, popcornVideo;
-
+      
       //  Ensure we're looking at a dom node and that it has an id
       //  otherwise Popcorn won't be able to find the video element
       if ( video.nodeType && video.nodeType === 1 && video.id ) {
+      
+        popcornVideo = Popcorn( "#" + video.id );
 
-        dataSources = video.getAttribute( "data-timeline-sources" ).split(",");
+        dataSources = ( video.getAttribute( "data-timeline-sources" ) || "" ).split(",");
 
         if ( dataSources.length )  {
 
             if ( dataSources && Popcorn.parsers[ dataType ] ) {
 
               //  Set up the video and load in the datasources
-              popcornVideo = Popcorn( "#" + video.id )[ parserFn ]( source );
+              popcornVideo[ parserFn ]( source );
 
 
             }