diff --git a/app/static/js/film.js b/app/static/js/film.js index 2bb69e7..570caff 100644 --- a/app/static/js/film.js +++ b/app/static/js/film.js @@ -1,4 +1,5 @@ var videoExtension +var continueTimecode function setVideoSrc(video, src) { var ext @@ -25,6 +26,9 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => { video.controls = true document.querySelector('main').appendChild(video) video.style.display = 'none' + if (continueTimecode) { + video.currentTime = continueTimecode + } function enterFullscreen(event) { video.requestFullscreen().catch(err => { console.log(`Error attempting to enable full-screen mode: ${err.message} (${err.name})`); @@ -37,7 +41,8 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => { } video.addEventListener('play', enterFullscreen); video.addEventListener('fullscreenchange', event => { - if (!document.fullscreen) { + if (document.fullscreenElement === null) { + continueTimecode = video.currentTime video.remove() if (document.fullscreenElement) { document.exitFullscreen(); @@ -47,6 +52,7 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => { video.addEventListener('pause', event => { }) video.addEventListener('ended', event => { + continueTimecode = 0 video.remove() if (document.fullscreenElement) { document.exitFullscreen(); diff --git a/app/templates/film.html b/app/templates/film.html index bca2be2..1b21cf5 100755 --- a/app/templates/film.html +++ b/app/templates/film.html @@ -33,7 +33,7 @@ body {
{{ film.data.summary|safe }}