Skip to content

fix: retry hung TV playlist reads instead of resetting playback - #24

Merged
TheCryptoDonkey merged 1 commit into
mainfrom
fix/tv-playlist-attempt-timeout
Oct 27, 2026
Merged

TheCryptoDonkey merged 1 commit into
mainfrom
fix/tv-playlist-attempt-timeout

Conversation

@TheCryptoDonkey

Copy link
Copy Markdown
Member

Problem

A public viewer recorded five hard engine resets in a 13-minute run, all reporting signal timed out. Each reset tore down a MediaSource holding 15-20 s of good media and gave about 1.5-2 s of lost picture and sound with a spinner.

CmafPlayer.text() gave each playlist read a single AbortSignal.timeout(10000) across all retries. The backoff schedule alone (0.5 + 1.5 + 3 + 5 s) sums to 10 s, and a TimeoutError was not retryable, so one hung edge response became a fatal engine error. Receiver-side playlists stayed fast throughout (loopback p99 2 ms); the public edge occasionally hangs a single request.

Change

  • Each playlist attempt has its own 4 s deadline; a timed-out attempt is retried like a network error. Only Stop ends the read. Worst case is about 30 s, inside the 20-30 s buffer.
  • Fragment loading is unchanged.
  • Player version 2026.10.27.8; docs/tv-player.md updated.

Verification

  • New tests in tests/tv-playlist.test.mjs: hung first attempt, 503 then slow reply, Stop during a hung attempt. The hung-attempt test fails on the previous engine after exactly 10 s and passes with this change.
  • TV JS suites 59/59, preview and script tests, asset check.
  • Fault injection over the real public route (one playlist response held 12 s): previous engine reset with signal timed out; this engine retried with no reset, no state change and at least 18 s of buffer throughout.

A single playlist read had one ten-second deadline across all attempts.
The backoff schedule alone sums to ten seconds, and a hung response on the
public edge aborted the whole read, which the player treated as fatal and
answered with a full engine reset while 15-20 seconds of media were buffered.
A 13-minute public reference run recorded five such resets ('signal timed
out'), each a 1.5-2 second loss of picture and sound with a spinner.

Each attempt now has its own four-second deadline and a timed-out attempt is
retried like a network error; only Stop ends the read.
@TheCryptoDonkey
TheCryptoDonkey merged commit eee43ee into main Oct 27, 2026
6 checks passed
@TheCryptoDonkey
TheCryptoDonkey deleted the fix/tv-playlist-attempt-timeout branch October 28, 2026 00:21
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.

1 participant