1
votes

I have a mysql table that has two fields - an identifier number, and text based url's stored in it of locations of some mp4 videos. I want to make a very simple html5 video player that when opened, looks at the database, loads the queue, and starts playing. when one song ends, it loads the next one in the list.

I'm pretty proficient with php and mysql, but what's stumping me is what code to alter on the html5 video player to get it to move to the next song in the database when the current song ends. basically in pseudo code :

(php/mysql) select idNum, URL from tracklist

HTML5 video source = first URL in the list

play the video

function (video's over) get the next url using ajax or something (???) swap out the player's source keep playing with as little a gap as possible. rinse and repeat :-)

simple really. just dont quite understand how to harness the html5 video and make it play nice with php. help!

1

1 Answers

0
votes

If your playlist isn't likely to change very often, then I would generate some JavaScript containing an object for it when the page is called. You can load the HTML5 player with the source of the first video in the playlist and bind an event handler to the player such that when the video ends, it loads up the next one. See http://www.w3.org/2010/05/video/mediaevents.html for an example of a player and the events that are fired.

If the playlist is likely to change very often (i.e. after the page loads), you could make an Ajax call to update the playlist.