use webkit prefix consistently, cleanup commented code, remove semicolons because we dont like them
This commit is contained in:
parent
410494d1ae
commit
0fcd40b579
1 changed files with 12 additions and 16 deletions
|
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue