, MediaElementJS - , "src" .
Using the MediaElementJS API to access this src attribute is the best way to manage cross-browser issues with cross-sources (for example, for YouTube videos or Flash return). Here is how I did it:
player.pause();
player.setSrc(myNewSourceURL);
player.load();
I also turned this code into a MediaElementJS plugin, there will be many nice things like managing a playlist, next and prev buttons, and a playlist panel. You can find pullRequest on github .
Here is a sample code to create a playlist:
new MediaElementPlayer('#myvideo', {
features : ['prev','playpause','next', 'progress'],
success : function(mediaElement, domObject){
domObject.player.loadPlaylist([
{src: "http://domain.com/video/video1.mp4"},
{src: "http://domain.com/video/video2.mp4"},
{src: "http://domain.com/video/video3.mp4"},
]);
}
});
Then, when the sketch is clicked:
var index = 2;
player.setItem(index);
source
share