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
|
// For some unknown reason, we need to set the timeline-video to display:none
|
||||||
// when playing the film in fullscreen, otherwise the fullscreen video
|
// 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'
|
document.getElementById('timeline-video').style.display = 'none'
|
||||||
if (!video) {
|
if (!video) {
|
||||||
video = document.createElement('video')
|
video = document.createElement('video')
|
||||||
|
@ -37,23 +37,17 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => {
|
||||||
if (continueTimecode) {
|
if (continueTimecode) {
|
||||||
video.currentTime = 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) {
|
function onFullscreenChange (event) {
|
||||||
if (document.fullscreenElement === null || document.webkitFullscreenElement === null) {
|
if (document.fullscreenElement === null || document.webkitFullscreenElement === null) {
|
||||||
continueTimecode = video.currentTime
|
continueTimecode = video.currentTime
|
||||||
video.remove()
|
video.remove()
|
||||||
document.getElementById('timeline-video').style.display = 'block'
|
document.getElementById('timeline-video').style.display = 'block'
|
||||||
if (document.fullscreenElement || document.webkitFullscreenElement) {
|
if (document.fullscreenElement) {
|
||||||
document.exitFullscreen();
|
document.exitFullscreen()
|
||||||
|
}
|
||||||
|
if (document.webkitFullscreenElement) {
|
||||||
|
document.webkitExitFullscreen()
|
||||||
}
|
}
|
||||||
video = null
|
video = null
|
||||||
}
|
}
|
||||||
|
@ -65,15 +59,18 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => {
|
||||||
video.addEventListener('ended', event => {
|
video.addEventListener('ended', event => {
|
||||||
continueTimecode = 0
|
continueTimecode = 0
|
||||||
video.remove()
|
video.remove()
|
||||||
|
document.getElementById('timeline-video').style.display = 'block'
|
||||||
|
if (document.webkitFullscreenElement) {
|
||||||
|
document.webkitExitFullscreen()
|
||||||
|
}
|
||||||
if (document.fullscreenElement) {
|
if (document.fullscreenElement) {
|
||||||
document.exitFullscreen();
|
document.exitFullscreen();
|
||||||
}
|
}
|
||||||
video = null
|
video = null
|
||||||
});
|
})
|
||||||
video.play()
|
video.play()
|
||||||
video.style.display = 'block'
|
video.style.display = 'block'
|
||||||
if (video.webkitRequestFullscreen) {
|
if (video.webkitRequestFullscreen) {
|
||||||
console.log('webkitRequestFullscreen exists')
|
|
||||||
video.webkitRequestFullscreen()
|
video.webkitRequestFullscreen()
|
||||||
} else {
|
} else {
|
||||||
video.requestFullscreen().catch(err => {
|
video.requestFullscreen().catch(err => {
|
||||||
|
@ -82,6 +79,5 @@ document.querySelector('a#play-fullscreen').addEventListener('click', event => {
|
||||||
video = null
|
video = null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue