I'm using JwPlayer with fancybox, and I would like to detect when user has watched finish the video.
I tried aftershow and oncomplete but it's not working. Below is my code. Can anyone help to see what I should change to be able to detect once the video has finished playing? Thank you!
$(".video_show").fancybox({
content : '<div id="myElement">Loading the player...</div>',
fitToView : true,
afterShow : function() {
this.content = jwplayer('myElement').setup({
flashplayer: "js/jwplayer.flash.swf",
file: this.href,
height: 360,
width: 640,
autoStart : false,
stretching : "fill"
});
// Store references to tag and rates
var videoTag;
var currentRate = 1;
},
events:{
onComplete: function() {
return alert("Im done");
}
}
});
Change:
stretching : "fill",
To:
stretching : "fill",
events:{
onComplete: function() {
return alert("Im done");
}
}