Skip to content

Fix video playback position reset to 0:00 on full-screen close#2207

Open
bojanstef wants to merge 1 commit into
TelegramMessenger:masterfrom
bojanstef:fix-1922-video-resume
Open

Fix video playback position reset to 0:00 on full-screen close#2207
bojanstef wants to merge 1 commit into
TelegramMessenger:masterfrom
bojanstef:fix-1922-video-resume

Conversation

@bojanstef

@bojanstef bojanstef commented Jun 20, 2026

Copy link
Copy Markdown

Addresses the resume regression in #1922 (the primary symptom; the issue's inline-preview "continuity" point is a separate behavior change and is not included here).

Problem. Partially-watched videos always restart at 0:00 instead of resuming.

Cause. UniversalVideoGalleryItemNode.maybeStorePlaybackStatus persists the position from every videoNode.status update. On full-screen close the player resets and emits a final status with timestamp ≈ 0; the old else branch wrote 0.0, overwriting the saved position on every close, so the stored resume point ends up 0 and the next open starts at 0:00.

Runtime trace (play to ~0:16, close, re-open):

before:  store 16.0  →  store 0.0  (teardown reset overwrites it)  →  read 0.0  →  seek 0  →  0:00
after:   read 5.3 / read 8.5  (saved position survives)            →  resumes

After fix (skip to 0:19s)

after-fix.mov

@bojanstef bojanstef force-pushed the fix-1922-video-resume branch from cfec81f to 21d0122 Compare June 20, 2026 01:34
…ramMessenger#1922)

UniversalVideoGalleryItemNode.maybeStorePlaybackStatus persisted the playback
position from every MediaPlayerStatus delivered by the throttled status
subscription — including the teardown/reset status emitted when the full-screen
player is dismissed (timestamp ~0, with a freshly incremented seekId). That
status fell into the `else` branch and stored a position of 0.0, overwriting the
real saved position on every close. So the stored "resume" point was always 0
and the video always restarted at 0:00.

Persist only a genuine mid-video position; store the 0.0 "restart" sentinel only
when the video is actually near the end; and leave any saved position untouched
for timestamp <= 5s (which also covers the teardown reset that caused the bug).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bojanstef bojanstef force-pushed the fix-1922-video-resume branch from 21d0122 to f5886ab Compare June 20, 2026 01:37
@bojanstef bojanstef marked this pull request as ready for review June 20, 2026 01:51
@bojanstef

Copy link
Copy Markdown
Author

@dimonstrik can I get a review

@sabalandemichael2

sabalandemichael2 commented Jun 20, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants