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

JWPlayer 7.5 oncomplete change to -1 second and don't show image


Hello everyone,

I have a video playing and in the end, when it's all through and on state "complete" I would like it to go back 1 second and stop there - not showing the poster, just the video at this point.
I have tried

on('time', function(timing) {
var currentPosition = timing.position;
var lengthOfVideo = timing.duration;

if((currentPosition >= lengthOfVideo-1 && currentPosition < lengthOfVideo))
{
__globalCounter = 1;
__globalTiming = timing;
__globalComplete = true;
}
};

with a check in

on('complete', function() {
if (__globalComplete)
{
__player.seek(__globalTiming.position);
__player.play(false);
__player.pause(true);
}
};


This ends in an infinite loop and I really have no idea why - I am still new to this whole topic though. So every help would be appreciated :)

2 Community Answers

Nat

User  
0 rated :

I did it with converting the timing into floats, and instead of using on('complete') I simply paused the video inside the on('time') event when the if statement is true. Hiding the controls and fake a "complete" status that way.
Not very nice, but it's doing its job.

Heidi

JW Player Support Agent  
0 rated :

Hi Nat, when you use ‘time’ that event will fire continually while your stream plays. You will need to use ‘once’ to only have ‘time’ fire one time. Hope this helps.

This question has received the maximum number of answers.