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

How to have a "Continue Playing" and a "Restart from Beginning" button


So I have my backend set up to record the last progress on every video that a user has watched. Atm, JWPlayer comes with a play button. Is there a way to have two buttons like Netflix, one for continue from the last position, and one for starting from the beginning?

1 Community Answers

Todd

JW Player Support Agent  
0 rated :

There’s not built-in functionality for this, but it’s actually pretty easy to implement this with our Javascript API:

1) Normally step one is to record the last progress of the video somehow, usually an onTime() or window.unload function, and write it to a cookie, but it sounds like you already have that data

2) In an onReady() function, check to see if that cookie exists (meaning you know the time where the video was last viewed) and then display the two buttons

3) If the viewer clicks Resume, use jwplayer().seek(time_last_viewed_in_seconds) to send them back to the part where they last left off. If you want to be really nice, my suggestion would be to rewind five seconds so the viewer has a little more context of where they left off, so I would use something like jwplayer().seek(last_viewed-5);

This question has received the maximum number of answers.