Fix fullscreen video in iOS Safari

This commit is contained in:
Bill Thornton 2020-07-29 09:28:06 -04:00
parent 1787538081
commit 585667067b
2 changed files with 25 additions and 0 deletions

View File

@ -18,6 +18,11 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
screenfull.on('change', function () {
events.trigger(player, 'fullscreenchange');
});
} else {
// iOS Safari
document.addEventListener('webkitfullscreenchange', function () {
events.trigger(player, 'fullscreenchange');
}, false);
}
}
@ -1399,6 +1404,11 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
return player.isFullscreen();
}
if (!screenfull.isEnabled) {
// iOS Safari
return document.webkitIsFullScreen;
}
return screenfull.isFullscreen;
};
@ -1410,6 +1420,16 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
if (screenfull.isEnabled) {
screenfull.toggle();
} else {
// iOS Safari
if (document.webkitIsFullScreen && document.webkitCancelFullscreen) {
document.webkitCancelFullscreen();
} else {
const elem = document.querySelector('video');
if (elem && elem.webkitEnterFullscreen) {
elem.webkitEnterFullscreen();
}
}
}
};

View File

@ -554,6 +554,11 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
if (screenfull.isEnabled) {
screenfull.exit();
} else {
// iOS Safari
if (document.webkitIsFullScreen && document.webkitCancelFullscreen) {
document.webkitCancelFullscreen();
}
}
};