From 7c0669190fc8df809553c8cbdcaa312e2cfc449e Mon Sep 17 00:00:00 2001 From: Loewy Date: Wed, 12 Aug 2026 15:18:49 -0700 Subject: [PATCH] Validate package lifecycle in CI --- .gitea/workflows/check-js.yaml | 8 ++++---- src/Video.web.tsx | 20 +++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/check-js.yaml b/.gitea/workflows/check-js.yaml index bf9bc182..44563f46 100644 --- a/.gitea/workflows/check-js.yaml +++ b/.gitea/workflows/check-js.yaml @@ -15,8 +15,8 @@ jobs: shell: nix shell nixpkgs#nodejs_22 nixpkgs#yarn -c bash -e {0} steps: - uses: actions/checkout@v4 - - name: Install node_modules - run: yarn install --immutable --ignore-scripts + - name: Install node_modules and build package + run: yarn install --immutable - name: Check TypeScript run: yarn tsc - name: Test web HLS @@ -30,8 +30,8 @@ jobs: shell: nix shell nixpkgs#nodejs_22 nixpkgs#yarn -c bash -e {0} steps: - uses: actions/checkout@v4 - - name: Install node_modules - run: yarn install --immutable --ignore-scripts + - name: Install node_modules and build package + run: yarn install --immutable - name: Run ESLint run: yarn lint - name: Verify auto-fix produces no changes diff --git a/src/Video.web.tsx b/src/Video.web.tsx index c473ec89..1fccca7e 100644 --- a/src/Video.web.tsx +++ b/src/Video.web.tsx @@ -133,24 +133,30 @@ const Video = forwardRef( autorotate ??= fsPrefs.current.fullscreenAutorotate; const run = async () => { + const browserOrientation = screen.orientation as + | { + lock?: (orientation: 'landscape' | 'portrait') => Promise; + unlock?: () => void; + } + | undefined; try { if (newVal) { await nativeRef.current?.requestFullscreen({ navigationUI: 'hide', }); if (orientation === 'all' || !orientation || autorotate) { - if (typeof screen.orientation?.unlock === 'function') { - screen.orientation.unlock(); + if (typeof browserOrientation?.unlock === 'function') { + browserOrientation.unlock(); } - } else if (typeof screen.orientation?.lock === 'function') { - await screen.orientation.lock(orientation); + } else if (typeof browserOrientation?.lock === 'function') { + await browserOrientation.lock(orientation); } } else { if (document.fullscreenElement) { await document.exitFullscreen(); } - if (typeof screen.orientation?.unlock === 'function') { - screen.orientation.unlock(); + if (typeof browserOrientation?.unlock === 'function') { + browserOrientation.unlock(); } } } catch (e) { @@ -452,7 +458,7 @@ const useMediaSession = ( nativeRef: RefObject, showNotification: boolean, ) => { - const isPlaying = !nativeRef.current?.paused ?? false; + const isPlaying = nativeRef.current ? !nativeRef.current.paused : false; const progress = nativeRef.current?.currentTime ?? 0; const duration = Number.isFinite(nativeRef.current?.duration) ? nativeRef.current?.duration