Skip to content

fix(media): rewind instead of reloading once the media has played - #87

Merged
skjnldsv merged 1 commit into
mainfrom
fix/replay-keeps-buffer
Oct 2, 2026
Merged

skjnldsv merged 1 commit into
mainfrom
fix/replay-keeps-buffer

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Replaying a video downloaded the whole file again, every time.

Fixes nextcloud/viewer#2585

donePlaying() reloaded the element (media.load()) once it ended, to bring the poster back. A reload throws away what was buffered, and Firefox fetched the file again on the next play. It now stops the player instead: paused at the start, which is what plyr shows its poster over (.plyr--stopped.plyr__poster-enabled), and the buffer stays.

The poster after playing is a feature people use, a film and a picture of the same name side by side, so it gets tests. The playground has trailer.webm with trailer.jpg beside it, and an e2e test plays it to the end, checks the poster is back on top, plays it again and checks nothing was fetched. The video is served no-store there, otherwise Chromium answers the reload from its cache and the test passes on main too; with it, main makes a fourth request and fails. Unit tests cover stop() being used rather than load(), and a rewind by hand when plyr has no player yet.

Based on #86, without which the video never gets its poster in the first place. Only run locally in Chromium; Firefox runs in CI.

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.56%. Comparing base (3d47c85) to head (3286477).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #87      +/-   ##
==========================================
+ Coverage   89.79%   90.56%   +0.76%     
==========================================
  Files          39       39              
  Lines        2969     2978       +9     
  Branches      642      649       +7     
==========================================
+ Hits         2666     2697      +31     
+ Misses        293      270      -23     
- Partials       10       11       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skjnldsv
skjnldsv force-pushed the fix/replay-keeps-buffer branch from 029b6e9 to 4cc7cda Compare October 2, 2026 03:15
@skjnldsv
skjnldsv force-pushed the fix/replay-keeps-buffer branch from 4cc7cda to c1cba49 Compare October 2, 2026 06:04
Base automatically changed from fix/handler-peers to main October 2, 2026 06:12
@skjnldsv
skjnldsv force-pushed the fix/replay-keeps-buffer branch from 76be8c2 to 05b358b Compare October 2, 2026 07:32
donePlaying() reloaded the element to bring the poster back, which threw
away what it had buffered: every replay downloaded the whole file again.
Stopping the player at the start shows plyr's poster just the same.

The playground gets a video with a poster of the same name beside it,
and an e2e test that the poster is back and a replay fetches nothing.
The audio e2e no longer counts the error Firefox raises on a machine
with no audio device: the reload used to clear it by accident.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv
skjnldsv force-pushed the fix/replay-keeps-buffer branch from 05b358b to 3286477 Compare October 2, 2026 07:45
@skjnldsv
skjnldsv merged commit 96f39ea into main Oct 2, 2026
20 checks passed
@skjnldsv
skjnldsv deleted the fix/replay-keeps-buffer branch October 2, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted status: review Waiting for reviews type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Files - video playback downloads file on every playback (Firefox)

1 participant