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

reconnect automatically when client gets back the lost connection


I want the client to automatically connect to the server when the connection is back and the video should start playing where it stopped before. Is it possible..?

Till now i tried making connection again after 3 seconds and video starts from first.
jwplayer().onBuffer(function()
{
theTimeout = setTimeout(function()
{
window.location = window.location.href;
},3000);
});

But i want the video to start from where it stopped playing before..
can anyone help me regarding this issue

16 Community Answers

Andrew

JW Player Support Agent  
0 rated :

What kind of file is being used here? Is this an MP4 or an HLS stream? Do you happen to have a link?

ramkumar.vooda

User  
0 rated :

it is mp4 file.

Andrew

JW Player Support Agent  
0 rated :

Is there a link to where you’re running this as well?

ramkumar.vooda

User  
0 rated :

The server was setup in local network

Andrew

JW Player Support Agent  
0 rated :

We’ll need to see a live example to assist further.

ramkumar.vooda

User  
0 rated :

http://jsfiddle.net/VRKumar/bmLd3ycj/27/

Andrew

JW Player Support Agent  
1 rated :

I’d suggest doing something with onTime constantly updating a variable that states the position within the file. When an error occurs, this will keep the variable sound. At a particular interval, you can attempt to reload the file and then seek to the last recorded position that was dictated with onTime.

ramkumar.vooda

User  
0 rated :

yes sir, but how to know when the buffer stops, I want to know any function is there so that it triggers when buffer stops running.
so then i can use timout and then reload the video and seek the required position

Andrew

JW Player Support Agent  
0 rated :

Indeed.
http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference#buffer
You can use something with onBuffer to detect when the buffer is empty and then detect the position that you are currently viewing.

ramkumar.vooda

User  
0 rated :

but in my code onBuffer is triggering when the video starts playing..
But i want some function which triggers when buffer stops.
so then i can wait for 5 seconds and try to reload the video..

Andrew

JW Player Support Agent  
0 rated :

You can potentially return the buffer amount with onBufferChange
buffer (Number): Percentage between 0 and 100 of the current media that is buffered.

ramkumar.vooda

User  
0 rated :

but how to know when was the client disconnected from the server?

Andrew

JW Player Support Agent  
0 rated :

If the player gets disconnected and no longer has a buffer, it would be safely assumed that there was a server disconnect.

ramkumar.vooda

User  
0 rated :

so how to know there is no longer a buffer...is there any function for that..?

Andrew

JW Player Support Agent  
0 rated :

Indeed, using the buffer API call will return the amount of buffer during playback at a given moment.

ramkumar.vooda

User  
0 rated :

ok...thank you

This question has received the maximum number of answers.