From 9c8c9fbcd89ca312c3a48a4bbbbb5ac2819d89e1 Mon Sep 17 00:00:00 2001 From: Igor Chernega Date: Fri, 21 Jul 2017 22:45:38 +0300 Subject: [PATCH] Fix video resume --- js/everything.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/everything.js b/js/everything.js index 671b789b..152ac62e 100644 --- a/js/everything.js +++ b/js/everything.js @@ -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); } @@ -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