Skip to content
July 24, 2012 / Danii Oliver

HTML 5 Custom Random Playlist (Beta 1.0) Update

MP4, webm & ogv dynamic extensions and push to src for cross browser MIME type compatibility

OLDCODING FOR NONE VIDEO.JS INTEGRATION LISTENING FOR ENDED VIDEO.JS LISTENS FOR PAUSE

function nextVideo()
{
 //alert('Ended');
 var playList = sessionList.join(',');
 var video = document.getElementsByTagName('video');
 var videoOne = document.getElementById('video1_html5_api'); 
 var sources = videoOne.getElementsByTagName('source');
 var webm = document.getElementById('webm');
 var mp4 = document.getElementById('mp4');
 var ogv = document.getElementById('ogv');
 videoOne.setAttribute("src", path + sessionList[0]+ ".mp4");
 webm.setAttribute("src",path + sessionList[0]+ ".webm");
 mp4.setAttribute("src", path + sessionList[0]+ ".mp4");
 ogv.setAttribute("src", path + sessionList[0]+ ".ogv");
 if (sessionList.length !== 0) {
 videoOne.load();
 videoOne.play();
 }
 else if(sessionList.length === 0){
 videoOne.setAttribute("src", path + intro + ".mp4");
 webm.setAttribute("src", path + intro+ ".webm");
 mp4.setAttribute("src", path +intro+ ".mp4");
 ogv.setAttribute("src", path + intro+ ".ogv");
 videoOne.load();
 //videoOne.play(); //WITH CURRENT CODE AND THIS UNCOMMENTED THE LIST REPOPULATES and doesnt play 
 //On the vides just keep going. 
 //DON'T PLAY JUST REPOPULATE LIST INCASE VIEWER WANTS TO PLAY ALL AGAIN.
 videoOne.setAttribute("poster", "media/END.jpg");
 for (i=0; i<videoArray.length; i++){
 sessionList.push(videoArray[i]);
 }
 sessionList.push(outro);
 if(videoOne.paused){
 videoOne.load();
 videoOne.pause(); 
 }
 }
 else {
 }
 sessionList.shift();
 return sessionList;
}
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: