Reputation: 21
I want to play my default or any other file when one video ends. is there any method to detect end of video in JWPLAYER.
Any example will be very helpful.
Upvotes: 2
Views: 2094
Reputation: 99
you can use playlist like this :
var myVideo = "yourDefaultVideoURL";
jwplayer("myElement").setup({
playlist: [{
image: "/assets/sintel.jpg",
sources: [
{ file: "/assets/sintel.mp4", label: "360p" },
{ file: myVideo , label: "720p HD" }
],
title: "Sintel Movie Trailer"
}]
});
documentation here : http://www.longtailvideo.com/support/jw-player/28842/working-with-playlists/
Upvotes: 1
Reputation: 4201
You can use onComplete() and load() using our JavaScript API, to do this:
http://www.longtailvideo.com/support/jw-player/28851/javascript-api-reference
Here is some sample code:
<!DOCTYPE html>
<script src="http://www.longtailvideo.com/jwplayer/jwplayer.js"></script>
<center><div id='my-video'></div></center>
<script type='text/javascript'>
jwplayer('my-video').setup({
image: "http://content.bitsontherun.com/thumbs/i8oQD9zd-640.jpg",
file: "http://content.bitsontherun.com/videos/i8oQD9zd-kNspJqnJ.mp4"
});
jwplayer().onComplete(function() { jwplayer().load({file:"http://www.longtailvideo.com/jw/upload/bunny.mp4"});jwplayer().play() });
</script>
Upvotes: 0