Skip to content

fix(player): resume live ts streams without range#593

Merged
stackia merged 6 commits into
mainfrom
codex/web-player-live-ts-resume
Jun 27, 2026
Merged

fix(player): resume live ts streams without range#593
stackia merged 6 commits into
mainfrom
codex/web-player-live-ts-resume

Conversation

@stackia

@stackia stackia commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What changed

This updates the web player live TS backpressure path so a single-URL live TS stream resumes with a fresh GET instead of a byte Range request. The fresh request is treated as a TS input boundary, reusing the same overlap/gap normalization behavior used by static TS segment lists.

The player now drives buffer-full recovery from timeupdate and SourceBuffer updateend events instead of a polling timer. HLS keeps its discrete segment behavior: HLS VOD still uses forward-buffer throttling, and HLS live remains playlist-driven.

Why

Live TS URLs do not support byte-range continuation semantics. After buffer pressure aborts a request, resuming with Range can restart the stream in a way that looks like TS discontinuity and can corrupt the output timeline. HLS segments have different semantics, so the reconnect behavior must stay isolated to continuous live TS.

Validation

  • pnpm exec biome check web-ui/src/mpegts/player/mse.ts web-ui/src/mpegts/player/mpegts-player.ts web-ui/src/mpegts/worker/pipeline.ts
  • pnpm run type-check:tsc
  • pnpm exec vite build web-ui

src/embedded_web_data.h and local test assets are intentionally not included.

@stackia stackia marked this pull request as ready for review June 27, 2026 15:27
@stackia stackia requested a review from Copilot June 27, 2026 15:27
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-593.eastasia.1.azurestaticapps.net

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the web UI MPEG-TS player/worker pipeline so single-URL continuous live TS streams recover from backpressure by restarting with a fresh GET (instead of resuming via byte-Range), and replaces watermark polling with event-driven backpressure updates.

Changes:

  • Add a ContinuousLiveSegmentSource for single-URL live TS streams and introduce SourceMode in the worker pipeline to drive resume behavior.
  • Extend FetchLoader with a resumeMode option ("range" vs "restart") and a new onRestarted callback to reset TS input state on restart.
  • Drive backpressure recovery from timeupdate + SourceBuffer updateend (via onBufferUpdated) instead of an interval timer.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web-ui/src/mpegts/worker/segment-source.ts Adds a segment source for continuous single-URL live TS that yields an endless stream of “new cycle” metas.
web-ui/src/mpegts/worker/pipeline.ts Introduces source mode selection and wires "restart" resume semantics + TS input boundary handling for continuous live TS.
web-ui/src/mpegts/player/mse.ts Adds onBufferUpdated hook fired from SourceBuffer updateend.
web-ui/src/mpegts/player/mpegts-player.ts Replaces polling-based watermark throttle with event-driven backpressure updates and unifies pause/resume handling.
web-ui/src/mpegts/io/fetch-loader.ts Adds restart resume mode and restart callback to support fresh-GET recovery.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web-ui/src/mpegts/worker/pipeline.ts
Comment thread web-ui/src/mpegts/io/fetch-loader.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b5e38f2a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web-ui/src/mpegts/worker/pipeline.ts
Comment thread web-ui/src/mpegts/worker/pipeline.ts
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-593.eastasia.1.azurestaticapps.net

@stackia stackia force-pushed the codex/web-player-live-ts-resume branch from 18a8d26 to decf29f Compare June 27, 2026 15:50
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-593.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-593.eastasia.1.azurestaticapps.net

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-593.eastasia.1.azurestaticapps.net

@stackia stackia force-pushed the codex/web-player-live-ts-resume branch from def43c0 to f3db6ee Compare June 27, 2026 16:25
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-593.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-593.eastasia.1.azurestaticapps.net

@stackia stackia merged commit ba54b20 into main Jun 27, 2026
10 checks passed
@stackia stackia deleted the codex/web-player-live-ts-resume branch June 27, 2026 16:41
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