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

Seek on Android


Hi,

I'm trying to load a video and immediately seek to a position in the video, on an Android phone.
Here is the URL: delta-live.mediasocial.tv/mobile/jwplayer6.htm
Here is how the page works:
There are 2 instances of jwplayer.
Both loads a wildlife video when the page loads, but does not play the video.
After 10 seconds, the top player loads a 47 seconds video, and the bottom player loads a 27 minutes video.
If you click on the play icon, both players responds to the onPlay event, where there is a setTimeout to do a seek after x number of seconds. If I used 3 seconds as the timeout for both players, only the top player will seek properly.
The bottom player does not seek at all.
If I extend the timeout of the bottom player to 9 seconds, then it will seek but by then, the video would have been playing for a number of seconds, which I don't want it to do.
So it seems there is buffering before play and if the video is long, it takes time to buffer before it will actually play, by which time, the timeout would have expired and it won't seek.
The onPlay event will fire as soon as I manually click the play button, even though it looks like it is still buffering. Is there a property I can monitor so that I can know EXACTLY when the player will start playing ? Thanks.

FYI, this question has been posted on another thread that has not been answered and is now buried on page 3 of this forum. So I decided to post a new question so it will get more visibility.

3 Community Answers

Cooper Reid

JW Player Support Agent  
0 rated :

Can you try listening to the play event, then calling seek?

jwplayer(“player”).setup({
file: ‘bunny.mp4’,
title: ‘Bunny’,
image: ‘bunny.jpg’,
width:‘100%’
});

jwplayer().onPlay(function() {
jwplayer().seek(40); // 40 seconds in
});

-Cooper

lrmpham

User  
0 rated :

I changed the code to immediately seek onPlay, and it doesn't seek on Android. It will seek ok on desktop.

Cooper Reid

JW Player Support Agent  
0 rated :

You may have to do something like this:

function delaySeek() {
setTimeout(function() {
jwplayer().seek(40);
}, 50);
}
jwplayer().onPlay(delaySeek);

-Cooper

This question has received the maximum number of answers.