From 8d7620874fe39b7226fb2ccfd4761b0a08b230dd Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 13 Oct 2026 06:45:39 +0000 Subject: Video: the screen is never turned for a wide clip. Adam would rather a wide clip play with bars, and turn the phone himself when he wants it bigger. The pager no longer locks the screen to landscape for a wide clip (in the installed app or full screen in a tab), so it follows the phone throughout; in the installed app the pager no longer falls back to the browser's full screen either (that was only to be allowed to turn the screen). A thread's clip and a YouTube clip still go full screen on a tap, without the turn. feed-video-pager-test and fullscreen-notice-test check that nothing asks the screen to turn. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KPw21NEpWeTGu6swVASmBt --- src/features/messages.js | 55 ++++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/features/messages.js b/src/features/messages.js index 9bf1a09..1d9fd61 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -7646,15 +7646,13 @@ export function messagesFeature(ctx) { v.controls = true; const go = v.requestFullscreen || v.webkitRequestFullscreen || v.webkitEnterFullscreen; if (!go) return true; - Promise.resolve(go.call(v)).then(() => { - // a wide clip fills a phone on its side - if (v.videoWidth > v.videoHeight) screen.orientation?.lock?.('landscape').catch(() => {}); - }).catch(() => {}); + // (the screen isn't turned for it: a wide clip plays with bars, and the + // reader turns the phone if they want it bigger) + Promise.resolve(go.call(v)).catch(() => {}); return true; } if (typeof document !== 'undefined') document.addEventListener('fullscreenchange', () => { if (fsElement()) return; - try { screen.orientation?.unlock?.(); } catch {} // out of the pager's full screen some other way (Back on Android, Escape // on a computer): out of the pager too, in the one step if (pagerFs) { pagerFs = false; if (pager) dismissPager(); } @@ -7809,13 +7807,13 @@ export function messagesFeature(ctx) { } }; // One tap, as with any clip in a post: it plays, with sound, full screen - // (turned on its side). The still loads the player first; a player - // already going (autoplayed, muted) is unmuted and carried on. + // (the screen not turned: the reader turns the phone if they like). The + // still loads the player first; a player already going (autoplayed, + // muted) is unmuted and carried on. const full = (box) => { const go = box.requestFullscreen || box.webkitRequestFullscreen; if (!go) return; - Promise.resolve(go.call(box, { navigationUI: 'hide' })) - .then(() => screen.orientation?.lock?.('landscape').catch(() => {})).catch(() => {}); + Promise.resolve(go.call(box, { navigationUI: 'hide' })).catch(() => {}); }; const tapped = (e) => { if (e.target.closest('.yt-open, .vid-sound, iframe')) return; @@ -11845,8 +11843,9 @@ export function messagesFeature(ctx) { } // A clip tapped in the feed opens in the pager the same way, over the // feed's clips, picking up where it was. The pager takes the whole screen - // (what the player's own full screen did), and a wide clip turns the phone - // on its side — for that clip; past it the screen follows the phone. + // (what the player's own full screen did). The screen isn't turned for a + // wide clip — Adam would rather it play with bars and turn the phone + // himself — so it follows the phone throughout. function openClip(v, url) { try { const rowId = feedRowOf(v); @@ -11854,52 +11853,36 @@ export function messagesFeature(ctx) { const it = feedMediaItems(feed, 'videos').find((x) => x.row.id === rowId && x.url === url); if (!it) return false; tappedClips.add(url); // asked for by hand: no tap-to-play cover - const d = videoDims.get(url) || videoInfo.get(url) || {}; - const w = v.videoWidth || d.w || d.width, hh = v.videoHeight || d.h || d.height; const at = v.currentTime || 0; v.pause(); openMediaPager('videos', mediaKey(it), { fromFeed: true, at }); - pagerFullscreen(!!(w && hh && w > hh)); + pagerFullscreen(); return true; } catch { return false; } } let pagerFs = false; // the pager put the page full screen (and so takes it back out) - let pagerLock = false; // the pager turned the screen (and so lets it go) - // The installed app (the Play/Zapstore build, or a home-screen install) - // has no address bar: the pager already fills its window. Going full - // screen there only hid the system bars, and every time it did Chrome put - // up its "To exit full screen, drag from the top…" notice, which a page - // can't turn off. So there it doesn't: a wide clip asks the screen to turn - // without it, and goes full screen only if that's refused (the browser - // allows turning only in full screen) — the notice then, but the clip on - // its side. + // The installed app (the Play/Zapstore build — immersive since 1.13 — or a + // home-screen install) has no address bar: the pager already fills its + // window. Going full screen there only hid the system bars, and every time + // it did Chrome put up its "To exit full screen, drag from the top…" + // notice, which a page can't turn off. So there it doesn't. const installedApp = () => { try { return matchMedia('(display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui)').matches || document.referrer.startsWith('android-app://'); } catch { return false; } }; - function pagerFullscreen(wide) { - if (installedApp()) { - if (!wide || !screen.orientation?.lock) return; - screen.orientation.lock('landscape').then(() => { if (ui.mediaPager) pagerLock = true; else screen.orientation.unlock?.(); }, () => pagerGoFullscreen(true)); - return; - } - pagerGoFullscreen(wide); - } - function pagerGoFullscreen(wide) { + function pagerFullscreen() { + if (installedApp()) return; const d = document.documentElement; const go = d.requestFullscreen || d.webkitRequestFullscreen; if (!go || fsElement()) return; Promise.resolve(go.call(d, { navigationUI: 'hide' })).then(() => { if (!ui.mediaPager) { exitFs(); return; } pagerFs = true; - if (wide) screen.orientation?.lock?.('landscape').catch(() => {}); }).catch(() => {}); } const exitFs = () => { try { (document.exitFullscreen || document.webkitExitFullscreen || (() => {})).call(document)?.catch?.(() => {}); } catch {} }; function pagerUnFullscreen() { - if (pagerLock) { pagerLock = false; try { screen.orientation?.unlock?.(); } catch {} } if (!pagerFs) return; pagerFs = false; - try { screen.orientation?.unlock?.(); } catch {} if (fsElement() === document.documentElement) exitFs(); } // The words of the post, without the links to the media it carries. @@ -12597,8 +12580,6 @@ export function messagesFeature(ctx) { const v = pager.cur.querySelector('video.mp-media'); if (v) v.pause(); // how long a clip held the reader (the head start's measure of them) if (v && pager.curAt) { const secs = (Date.now() - pager.curAt) / 1000; dwell = dwell ? dwell * 0.7 + secs * 0.3 : secs; } - // past the clip it opened on, the screen follows the phone again - if (pagerFs || pagerLock) { pagerLock = false; try { screen.orientation?.unlock?.(); } catch {} } if (pager.fromFeed && video) el.classList.remove('show'); } pager.cur = e.target; -- cgit v1.2.3