set video position on resize

This commit is contained in:
j 2021-10-28 11:00:52 +01:00
parent b3b9224071
commit bffa0b69b1

View file

@ -41,6 +41,14 @@ function setVideoSrc(video, src) {
} }
} }
function resize() {
var video = document.querySelector('video')
if (video && video._frame) {
var rect = video._frame.getBoundingClientRect();
video.style.top = (rect.top + window.scrollY) + 'px'
}
}
function updatePlayer(video, frame, currentTime, out, src) { function updatePlayer(video, frame, currentTime, out, src) {
var rect = frame.getBoundingClientRect(); var rect = frame.getBoundingClientRect();
video.style.opacity = 0 video.style.opacity = 0
@ -362,3 +370,6 @@ if (config.annotations) {
} else { } else {
loadAnnotations(config) loadAnnotations(config)
} }
window.addEventListener('resize', resize, false);