Lock screen to landscape on fullscreen, unlock on exit
On mobile, entering fullscreen now also locks the screen orientation to landscape via the Screen Orientation API. Exiting fullscreen unlocks it, allowing the device to return to portrait. Applied to both the video player and audio player. Gracefully ignored on browsers that don't support screen.orientation.lock (e.g. iOS Safari). Also includes the playlist auto-scroll fix (committed separately). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
6e7d5d178a
commit
4887d0c517
5 files changed
+23
-15
No files matched your search
@@ -1118,6 +1118,10 @@ document.addEventListener('fullscreenchange', () => {
|
||||
const exit = fsBtn.querySelector('.ytp-svg-fs-exit');
|
||||
enter.style.display = isFullscreen ? 'none' : '';
|
||||
exit.style.display = isFullscreen ? '' : 'none';
|
||||
if (screen.orientation && screen.orientation.lock) {
|
||||
if (isFullscreen) screen.orientation.lock('landscape').catch(function(){});
|
||||
else screen.orientation.unlock();
|
||||
}
|
||||
});
|
||||
|
||||
// ── Theater mode ──────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user