Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

How to show popup at 3 last seconds of video ?




I know to show popup at 10 seconds but I don't know how to show popup at 3 last seconds of video. If video is 100 seconds of length, popup will be shown at 97 seconds. How to do that ? Thanks !

if (parseInt(event.position) > 10
{
code here
}

1 Community Answers

Todd

JW Player Support Agent  
0 rated :

You can getDuration() and then subtract 3 to determine the correct time to show your popup. The code would be something like:

jwplayer(‘video’).setup({
file:‘bunny.mp4’,
primary: ‘flash’
});

jwplayer().onPlay(function(){
var popupTime = jwplayer().getDuration() – 3;
jwplayer().onTime( function(event){
if ( jwplayer().getPosition() >= popupTime && jwplayer().getPosition() <= popupTime + .5 ) {
alert(‘hello’);
}
});
});

This question has received the maximum number of answers.