Skip to content

Commit

Permalink
Fix video resume
Browse files Browse the repository at this point in the history
  • Loading branch information
avalan4e57 committed Jul 21, 2017
1 parent 90424d9 commit 9c8c9fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/everything.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ var ZenPlayer = {
if (window.sessionStorage && window.sessionStorage.hasOwnProperty(videoID)) {
var resumeTime = window.sessionStorage[videoID];
var videoDuration = plyrPlayer.plyr.embed.getDuration();
if (videoDuration === 0) {
return;
}
if (!isNaN(resumeTime) && resumeTime < videoDuration - 3) {
plyrPlayer.plyr.embed.seekTo(resumeTime);
}
Expand Down Expand Up @@ -223,6 +226,9 @@ var ZenPlayer = {
if (window.sessionStorage) {
var currentTime = plyrPlayer.plyr.embed.getCurrentTime();
var videoDuration = plyrPlayer.plyr.embed.getDuration();
if (videoDuration === 0) {
return;
}

// Only store the current time if the video isn't done
// playing yet. If the video finished already, then it
Expand Down

0 comments on commit 9c8c9fb

Please sign in to comment.