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

If Paused, Pause OnSeek, If Playing, Keep Playing OnSeek


I'm stuck. I've figured out a way (finally) to get the player to respect the user has the video already paused when they seek, but now it pauses even when the user attempts to seek while playing.

playerInstance.on('pause', function(e){
delete realstate;
realstate = "paused";
});

playerInstance.on('seek', function(e){
var newoffset = e.offset;
//playerInstance.seek(newoffset);
var pstate = playerInstance.getState();
if(realstate == 'paused') {
playerInstance.pause(true);
}
console.log(newoffset +' '+ realstate);
});

I would have loved to add...

playerInstance.on('play', function(e){
delete realstate;
realstate = "playing";
});

But "play" event gets launched immediately with the Seek event, so it will cause the video to play after seek no matter what.

Any solution? JW7

Thanks
Ryan

10 Community Answers

contact

User  
0 rated :

I need to update this. The code above works on the Flash player but not on the HTML5 player, which just decides to start playing again after Seek (instead of remaining paused).

Feedback appreciated.

Cheers
ryan

contact

User  
0 rated :

Okay, got the pause to work again for both HTML5 and Flash by changing onSeek to onSeeked. But still wondering if way to have it pause when seeking during paused video, and play when seeking during playing video.

Randy

JW Player Support Agent  
0 rated :

Hey Ryan,

Thanks for reaching out to Support. I see you’ve provided the sample code above, but do you have your setup link so we can look at it?

Randy

contact

User  
0 rated :

Sure!

http://www.traileraddict.com/jwplayer.php

You will see it's very close. It seeks and plays if video is playing. Then seeks and pauses if video is paused.

However, if I ever hit pause it will never go back to play-seek-play. Just play-seek-pause or pause-seek-pause.

Thanks
Ryan

Randy

JW Player Support Agent  
0 rated :

Hello Ryan,

I will pass this along to our player engineers for review. This may be a potential bug.

Randy

contact

User  
0 rated :

I think that the play() function is actually built into the seek() function, which creates unfortunately loops when trying to go back and forth in preventing and then allowing play.

My theory at least.

contact

User  
0 rated :

Actually, I've been running extensive logs and I realized I had to combat the PLAY event/function built into SEEK event if the player is paused. Seems the player was built to ensure that seeking couldn't repause.

I figured it out:

playerInstance.on('seek', function(e){
os = playerInstance.getState();

});

playerInstance.on('seeked', function(e){
if(os == 'paused') {
console.log('insidde');
playerInstance.pause(true);
}

});

This works great with HTML5, but Flash ignores it completely. Sigh. Flash just thinks its playing all the time (as it runs the Play first on Seek event)

contact

User  
0 rated :

The easiest solutoin for everybody would to include the "oldstate" variable in the Seek event.

Ian W

User  
0 rated :

Has there been any more progress on this subject? We have the same issue, where a paused video, after seeking, begins playing again.

We'd prefer to be able to follow the YouTube way (which let's face it is pretty standard now): if video is paused, a seek jumps to the new position but stays paused until the user clicks to play. Is that possible in JW? (We're using JW 7 and placing as HTML5.)

Randy

JW Player Support Agent  
-2 rated :

Hello Ian,

Sorry for the delay on this. I have had our engineering team put this in as a feature request. it is currently within our pipeline but I cannot guarantee a hard deadline of when this will be implemented.

Thank you for the feedback.

Randy

This question has received the maximum number of answers.