Skip to content

Commit

Permalink
Merge commit 'rick/266' into 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
annasob committed Jan 18, 2011
2 parents 7b2658e + 01a0a3e commit 5dd6764
Showing 1 changed file with 44 additions and 15 deletions.
59 changes: 44 additions & 15 deletions popcorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,27 +920,56 @@
Popcorn.forEach( videos, function ( iter, key ) {

var video = videos[ key ],
dataSources, popcornVideo;

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 ) {

dataSources = video.getAttribute( "data-timeline-sources" );

// If the video has data sources, continue to load
if ( dataSources ) {

// Set up the video and load in the datasources
popcornVideo = Popcorn( "#" + video.id ).parseXML( dataSources );
popcornVideo = Popcorn( "#" + video.id );

dataSources = ( video.getAttribute( "data-timeline-sources" ) || "" ).split(",");

if ( dataSources.length ) {

Popcorn.forEach( dataSources, function ( source ) {

dataTemp = source.split( ":" );

dataType = dataTemp[0];

if ( dataTemp.length === 1 ) {

dataTemp = source.split( "." );

dataType = dataTemp[ dataTemp.length - 1 ];

}

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 ] ) {

// Set up the video and load in the datasources
popcornVideo[ parserFn ]( source );


}
});

}

// Only play the video if it was specified to do so
if ( !!popcornVideo.autoplay ) {
popcornVideo.play();
}

// Only play the video if it was specified to do so
if ( !!popcornVideo.autoplay ) {
popcornVideo.play();
}
}
}
});
}, false );

})(window, window.document);
})(window, window.document);

0 comments on commit 5dd6764

Please sign in to comment.