Skip to content

Add pause-resume live stream catch-up#1571

Open
gabrielMalonso wants to merge 6 commits into
igrigorik:masterfrom
gabrielMalonso:feature/live-catch-up
Open

Add pause-resume live stream catch-up#1571
gabrielMalonso wants to merge 6 commits into
igrigorik:masterfrom
gabrielMalonso:feature/live-catch-up

Conversation

@gabrielMalonso

@gabrielMalonso gabrielMalonso commented Jun 18, 2026

Copy link
Copy Markdown

Summary

This PR adds live-edge aware behavior for live streams. It contains two related, but distinct, opt-in behaviors:

  1. Live stream catch-up after pause/resume

    • If the viewer pauses near the live edge and later resumes behind live, the extension can temporarily increase playback speed until the stream catches up.
    • Once catch-up reaches the configured live-edge threshold, the temporary speed is cleared and playback returns to 1x.
  2. Optional reset to 1x at the live edge

    • Live streams often become awkward when playback remains above 1x after reaching the live edge, because there is no buffered future content to consume.
    • This PR adds an optional setting that resets manual speeds above 1x back to 1x when the stream reaches the live edge, even outside the pause/resume catch-up flow.

Both behaviors are disabled by default and can be configured from the options page.

Motivation

Live streams behave differently from normal on-demand videos. When watching VOD content, a speed above 1x is stable because the entire timeline is available. On live content, however, speed above 1x is usually useful only while there is latency to recover.

There are two common cases this PR addresses:

  • A user pauses a live stream, resumes behind the live edge, and wants the extension to catch up automatically.
  • A user manually watches a live stream faster than 1x, reaches the live edge, and wants playback to return to normal speed instead of staying in an unnecessary accelerated state.

The implementation keeps these behaviors explicit and opt-in so existing users keep the current behavior unless they enable the new settings.

User-facing options

This PR adds settings to:

  • enable or disable live catch-up
  • choose the catch-up playback speed, defaulting to 1.5x
  • choose the latency threshold where catch-up starts, defaulting to 10s behind live
  • choose the live-edge threshold where catch-up stops, defaulting to 3s behind live
  • optionally reset manual speeds above 1x when a live stream reaches the live edge

Behavior

Live stream catch-up

  • When a live video is paused close enough to the live edge, the controller records a short-lived catch-up candidate.
  • When playback resumes and the video is still behind the configured threshold, the controller temporarily applies the configured catch-up speed.
  • Once playback reaches the configured live-edge threshold, catch-up state is cleared and playback returns to 1x when the temporary catch-up speed was active.
  • Manual seeks invalidate pending catch-up state so an intentional jump in the timeline does not accidentally trigger catch-up.
  • Manual speed selections remain authoritative outside the pause/resume catch-up flow and are not saved over by the temporary catch-up speed.

Reset speed at live edge

  • When enabled, live streams can reset manual speeds above 1x back to 1x after reaching the configured live-edge threshold.
  • This behavior is independent from pause/resume catch-up: it applies to manually selected speeds as a separate live-stream convenience.
  • It only applies near the live edge and does not change normal on-demand video behavior.

Implementation notes

  • Adds new default settings and options UI for live catch-up and live-edge reset controls.
  • Adds live latency detection to the site handler layer.
  • Uses YouTube's movie_player.getProgressState() and getVideoData().isLive when available, because the native media seekable range can overstate YouTube live latency.
  • Falls back to native media seekable-range heuristics for other live-like media where the timeline indicates a live stream.
  • Tracks transient pause/resume/seek state on the video controller instance instead of persisting it.
  • Treats the live catch-up speed as authoritative while catch-up is active so the existing ratechange fight-back logic does not immediately undo it.
  • Avoids saving the temporary catch-up speed as the user's remembered speed.

Validation

  • npm test
  • npm run lint
  • npm run build
  • Loaded the built dist/ extension locally and manually tested the live catch-up flow in the browser.

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