diff --git a/app/static/js/film.js b/app/static/js/film.js index cf4415e..de873d4 100644 --- a/app/static/js/film.js +++ b/app/static/js/film.js @@ -24,7 +24,7 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => { // For some unknown reason, we need to set the timeline-video to display:none // when playing the film in fullscreen, otherwise the fullscreen video - // shows a black screen on Safari (15.0.2 on a laptop) + // shows a black screen on Safari (15.0.2 on an m1 laptop) document.getElementById('timeline-video').style.display = 'none' if (!video) { video = document.createElement('video') @@ -37,23 +37,17 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => { if (continueTimecode) { video.currentTime = continueTimecode } - // function enterFullscreen(event) { - // console.log('enter fullscreen called') - // video.removeEventListener('play', enterFullscreen) - // // setTimeout(() => { - // // video.style.display = 'block' - // // }, 150) - // } - // video.addEventListener('play', enterFullscreen); - function onFullscreenChange (event) { if (document.fullscreenElement === null || document.webkitFullscreenElement === null) { continueTimecode = video.currentTime video.remove() document.getElementById('timeline-video').style.display = 'block' - if (document.fullscreenElement || document.webkitFullscreenElement) { - document.exitFullscreen(); + if (document.fullscreenElement) { + document.exitFullscreen() + } + if (document.webkitFullscreenElement) { + document.webkitExitFullscreen() } video = null } @@ -65,15 +59,18 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => { video.addEventListener('ended', event => { continueTimecode = 0 video.remove() + document.getElementById('timeline-video').style.display = 'block' + if (document.webkitFullscreenElement) { + document.webkitExitFullscreen() + } if (document.fullscreenElement) { document.exitFullscreen(); } video = null - }); + }) video.play() video.style.display = 'block' if (video.webkitRequestFullscreen) { - console.log('webkitRequestFullscreen exists') video.webkitRequestFullscreen() } else { video.requestFullscreen().catch(err => { @@ -81,7 +78,6 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => { video.remove() video = null }); - } - + } } })