diff --git a/mobile/src/changelog.ts b/mobile/src/changelog.ts index 38b791c..65b55cd 100644 --- a/mobile/src/changelog.ts +++ b/mobile/src/changelog.ts @@ -16,6 +16,13 @@ export type ChangelogEntry = { }; export const CHANGELOG: ChangelogEntry[] = [ + { + id: '2026-08-18i', + date: 'August 2026', + items: [ + 'Dragging the progress bar now works on videos whose length the player has not reported yet. The handle and the time moved with your finger, but letting go did nothing; it seeks properly now.', + ], + }, { id: '2026-08-18h', date: 'August 2026', diff --git a/mobile/src/screens/PlayerScreen.tsx b/mobile/src/screens/PlayerScreen.tsx index 9655905..7b6a852 100644 --- a/mobile/src/screens/PlayerScreen.tsx +++ b/mobile/src/screens/PlayerScreen.tsx @@ -741,6 +741,11 @@ function NativeVideoPlayer({ params }: { params: RouteParams }) { ); const dur = knownDuration || durationSec || 0; + // Gest scrubbera powstaje raz (useMemo), więc czyta długość przez ref, nie z domknięcia. + const durRef = React.useRef(dur); + React.useEffect(() => { + durRef.current = dur; + }, [dur]); const panSeek = React.useMemo( () => @@ -818,10 +823,16 @@ function NativeVideoPlayer({ params }: { params: RouteParams }) { }) .onEnd((e) => { const w = scrubBarWidthRef.current; - if (w > 0 && knownDuration > 0) { + // `durRef`, NIE `knownDuration`: pasek RYSUJE się z `dur`, czyli z fallbackiem + // na długość z metadanych sceny, gdy player jeszcze nie zgłosił swojej. Warunek + // na samym `knownDuration` powodował, że przy takim źródle uchwyt i czas jechały + // za palcem, a po puszczeniu nie działo się nic. Ref, bo gest jest zbudowany raz + // i domykałby starą wartość. + const total = durRef.current; + if (w > 0 && total > 0) { const ratio = Math.max(0, Math.min(1, e.x / w)); try { - player.currentTime = ratio * knownDuration; + player.currentTime = ratio * total; } catch { // ignore } @@ -830,7 +841,7 @@ function NativeVideoPlayer({ params }: { params: RouteParams }) { scheduleHide(); }) .runOnJS(true), - [player, knownDuration, cancelHide, scheduleHide], + [player, cancelHide, scheduleHide], ); // ----- fullscreen toggle ----------------------------------------------------