1

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");
                        }
                     }

                }); 
GuRu
  • 1,726
  • 2
  • 21
  • 31
Sylph
  • 1,195
  • 3
  • 22
  • 36

1 Answers1

1

Change:

stretching : "fill",

To:

stretching : "fill",
events:{
                        onComplete: function() {
                            return alert("Im done");
                        }
                     }
emaxsaun
  • 4,086
  • 2
  • 11
  • 13