fix fullscreen bug with safari

This commit is contained in:
mrjvs 2023-10-18 17:14:59 +02:00
parent 2b240c8155
commit 79e4a689e0

View File

@ -80,6 +80,11 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
handleBuffered(videoElement.currentTime, videoElement.buffered) handleBuffered(videoElement.currentTime, videoElement.buffered)
); );
}); });
videoElement.addEventListener("webkitendfullscreen", () => {
isFullscreen = false;
emit("fullscreen", isFullscreen);
if (!isFullscreen) emit("needstrack", false);
});
} }
function unloadSource() { function unloadSource() {
@ -101,6 +106,8 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
isFullscreen = isFullscreen =
!!document.fullscreenElement || // other browsers !!document.fullscreenElement || // other browsers
!!(document as any).webkitFullscreenElement; // safari !!(document as any).webkitFullscreenElement; // safari
emit("fullscreen", isFullscreen);
if (!isFullscreen) emit("needstrack", false);
} }
fscreen.addEventListener("fullscreenchange", fullscreenChange); fscreen.addEventListener("fullscreenchange", fullscreenChange);