Skip to content

Stop the next episode hanging when next up and the end of the episode land together - #506

Open
Kisnov wants to merge 1 commit into
Moonfin-Client:mainfrom
Kisnov:fix/next-episode-double-advance
Open

Kisnov wants to merge 1 commit into
Moonfin-Client:mainfrom
Kisnov:fix/next-episode-double-advance

Conversation

@Kisnov

@Kisnov Kisnov commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Summary

When the next up countdown runs out within about a second and a half of the episode ending, the next episode spins for two minutes and then fails with "Stream preparation timed out" (#483). The countdown and the ended event both advance to the next episode: each awaits reportStop, closes the player and calls onPlayNext. The second one gets back from reportStop straight away and loads the next episode. Then the first one resumes and closes that new player while it is still preparing. Its onPlayNext asks for the same episode, so nothing loads it again.

Both paths now read loadGenerationRef before reportStop and return if a new load started in the meantime, so whichever one finishes second leaves the new player alone.

WebOSPlayer.js has no loadGenerationRef, so its handleEnded checks prevItemIdRef against its item instead. Its onPlayNextWithCleanup closes nothing after the stop, and a late call only asks for the episode that is already playing, so it stays as it is.

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • UI/UX update
  • Documentation update
  • Build/CI change
  • Other (describe):

Changes Made

  • TizenPlayer.js: onPlayNextWithCleanup and handleEnded return after reportStop if loadGenerationRef moved while it was pending.
  • WebOSPlayer.js: handleEnded returns after reportStop if prevItemIdRef is no longer its item.

Platform

  • Tizen (Samsung)
  • webOS (LG)
  • Both / Shared code

Testing

  • Tested on emulator
  • Tested on physical device — Tizen
  • Manual testing completed
  • Not tested (explain why): webOS, because there's no LG panel here. The webOS change comes from reading the code only.

I Manually tested on a Samsung TU43DU7105KXXC running Tizen 9, from a Moonfin_Tizen_Regular_2.9.0.wgt built off main b67705e7 with this branch merged in. That build also carried other open PRs. Result: when next up and the end of the episode land together, the next episode starts playing instead of hanging.

enact lint packages/app/src is clean and npm run lint:css is OK. enact test on this branch: 2260 passed, 3 failed. The three failures (personCredits ×2, seerrBadges ×1) hardcode US English date and currency output and fail on this machine's ca-ES locale, so they're unrelated to this change. npm run build:tizen builds from this branch.

Test Steps

  1. With next up on, play an episode that transcodes and whose skip outro prompt ends about 7–9 s before the file does. The next up card waits for that prompt, so its countdown runs out right as the episode ends.
  2. Let it play to the end without pressing anything. The next episode starts. On main it spins until "Stream preparation timed out" two minutes later.
  3. On an episode without an outro, let the countdown run out. It goes on to the next episode as before.

Screenshots (if applicable)

None attached. This is a timing fix with no visible UI change.

Checklist

  • Code builds successfully — npm run build:tizen builds from this branch
  • Code follows project style and conventions
  • No unnecessary commented-out code
  • No new warnings introduced — enact lint clean

🤖 Generated with Claude Code

The next up countdown and the ended event both advance to the next
episode after awaiting reportStop. The second one returns from it at
once and loads the next episode, then the first resumes and tears that
player down mid prepare, so the load spins until the 2 minute timeout.

Refs Moonfin-Client#483

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added Bug Something isn't working Tizen webOS labels Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

✅ Build Successful

All platform builds and the test suite passed. You can download the artifacts below.

Platform Status Artifact
webOS ✅ Passed Moonfin_webOS_*.ipk
Tizen Regular ✅ Passed Moonfin_Tizen_Regular_*.wgt
Tizen Oblong ✅ Passed Moonfin_Tizen_Oblong_*.wgt
Tizen Legacy ✅ Passed Moonfin_Tizen_Legacy_*.wgt
Property Value
Commit 9812e92
Workflow run Build #399

@github-actions github-actions Bot added the Vega label Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Tizen Vega webOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Playback] Next episode stuck loading for 2 minutes, then "Stream preparation timed out"

1 participant