Skip to content

Fix slow-starting stream playback fallbacks - #212

Merged
kristofferR merged 5 commits into
mainfrom
fix/issue-211-playback-timeouts
Jul 23, 2026
Merged

Fix slow-starting stream playback fallbacks#212
kristofferR merged 5 commits into
mainfrom
fix/issue-211-playback-timeouts

Conversation

@kristofferR

@kristofferR kristofferR commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • try the original MPEG-TS stream before speculative Xtream HLS or ffmpeg remux routes
  • give each playback route an independent startup timeout so one failed route cannot consume every fallback budget
  • allow slow initial proxy and ffmpeg media bytes while retaining the shorter steady-state stall timeout
  • keep timestamp-normalizing remux preferred during automatic recovery
  • add focused route-order and slow-start regression coverage

Root cause

Playback startup could spend its shared timeout on a speculative converted or remuxed route before reaching the original stream URL. The proxy also applied its six-second steady-state read timeout to the first media bytes, rejecting otherwise valid slow-starting providers.

Validation

  • 80 frontend tests
  • TypeScript typecheck
  • production frontend build
  • 250 Rust unit tests
  • 4 Rust integration tests
  • focused validation rerun after local review findings

Ref #211

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability for live MPEG-TS streaming when the first bytes arrive slowly by using a longer startup allowance, then switching to the steady-state timeout.
    • Refined MPEG-TS playback fallback behavior with explicit direct vs remux routes and updated fallback ordering for normal versus recovery scenarios.
    • Standardized playback timeouts and error messaging across native, HLS, and remux-assisted paths.
  • Tests

    • Added coverage for delayed initial chunks to verify startup tolerance, followed by steady-state timeout behavior.
    • Updated tests to validate direct/remux route ordering and new route structure.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kristofferR, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: de6484c0-7038-4307-bc80-14576d0bf10c

📥 Commits

Reviewing files that changed from the base of the PR and between c348266 and 5d3861d.

📒 Files selected for processing (2)
  • src/hooks/useStreamPlayer.ts
  • tests/useStreamPlayer.test.ts
📝 Walkthrough

Walkthrough

The proxy now separates startup and steady-state read timeouts for remux and chunked streams. Playback now uses typed direct/remux routes, mode-dependent ordering, per-route startup budgets, centralized failure handling, and updated route tests.

Changes

Streaming proxy timeout handling

Layer / File(s) Summary
Startup and steady-state forwarding
src-tauri/src/engine/stream_proxy.rs
Chunked forwarding applies startup and steady-state timeouts, classifies stream outcomes, and configures the localhost client with the startup timeout.
Remux reads and delayed-stream validation
src-tauri/src/engine/stream_proxy.rs
Remux output switches timeout modes after data arrives, with delayed-upstream helpers and tests covering the transition.

Playback route and startup handling

Layer / File(s) Summary
Typed MPEG-TS route selection
src/hooks/useStreamPlayer.ts, tests/useStreamPlayer.test.ts
MPEG-TS URLs are replaced by typed direct/remux routes with startup, recovery, and VOD ordering tests.
Per-route timeout and failure lifecycle
src/hooks/useStreamPlayer.ts
Native, HLS, and MPEG-TS startup paths use route-scoped timers, shared failure handling, error recording, cleanup, and initialization exception handling.
Recovery and fallback orchestration
src/hooks/useStreamPlayer.ts
Playback retries select route order by mode, reset previous errors, and apply per-route timeouts to fallback attempts.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant Upstream
  participant StreamingProxy
  participant PlaybackClient
  Upstream->>StreamingProxy: send delayed and subsequent chunks
  StreamingProxy->>StreamingProxy: apply startup then steady timeout
  StreamingProxy->>PlaybackClient: forward chunks or timeout result
Loading
sequenceDiagram
  participant PlaybackAttempt
  participant RouteHelper
  participant PlaybackEngine
  participant MediaElement
  PlaybackAttempt->>RouteHelper: request startup or recovery routes
  RouteHelper-->>PlaybackAttempt: return ordered direct/remux routes
  PlaybackAttempt->>PlaybackEngine: try route with timeout budget
  PlaybackEngine->>MediaElement: attach and load
  PlaybackEngine-->>PlaybackAttempt: complete or fail attempt
Loading

Poem

A bunny hops through streams so bright,
First bytes wait, then hops take flight.
Direct or remux, routes align,
Timers tidy every line.
“Fail,” says Hare, “then try once more!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: improving playback fallback behavior for slow-starting streams.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-211-playback-timeouts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kristofferR

Copy link
Copy Markdown
Owner Author

@codex review

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: eda0d3bd4f

ℹ️ 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".

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src-tauri/src/engine/stream_proxy.rs`:
- Around line 975-987: Update the read loop around received_data and
stream.next() so startup_read_timeout is measured against one fixed deadline
rather than restarted after each empty chunk. Recalculate each timeout from the
remaining time until that deadline while received_data is false, switch to
steady_read_timeout after the first non-empty chunk, and preserve the existing
timeout outcome.

In `@src/hooks/useStreamPlayer.ts`:
- Around line 1562-1567: Update the trailing fallback around tryNativePlayback
in useStreamPlayer so native-HLS URLs are excluded after the earlier native-HLS
attempt; retain this path only for non-HLS, mpegts, or unknown streams,
preserving existing fallback behavior for those cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: daf6fbb8-e59d-4a41-ae5c-de6da1e0c399

📥 Commits

Reviewing files that changed from the base of the PR and between 94a213e and eda0d3b.

📒 Files selected for processing (3)
  • src-tauri/src/engine/stream_proxy.rs
  • src/hooks/useStreamPlayer.ts
  • tests/useStreamPlayer.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Define agent interfaces and implementations in TypeScript for agent systems
Use clear naming conventions for agent classes and methods
Document agent behavior and responsibilities in comments or docstrings
Implement error handling in agent methods

Files:

  • tests/useStreamPlayer.test.ts
  • src/hooks/useStreamPlayer.ts
src-tauri/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Use Rust conventions: snake_case naming, 4-space indentation, thiserror for error types, and serde for serialization.

Files:

  • src-tauri/src/engine/stream_proxy.rs
src-tauri/src/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

src-tauri/src/**/*.rs: Keep backend responsibilities organized into models, engine, commands, state.rs, error.rs, and lib.rs according to their documented roles.
Use event-driven scanning: emit scan://channel-result events per channel, with frontend event updates batched using requestAnimationFrame.

Files:

  • src-tauri/src/engine/stream_proxy.rs
src-tauri/src/engine/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Place core IPTV processing logic, including parsing, checking, ffmpeg, proxy, and resume functionality, in the engine module.

Files:

  • src-tauri/src/engine/stream_proxy.rs
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use strict TypeScript with no unused locals or parameters.

Files:

  • src/hooks/useStreamPlayer.ts
🔇 Additional comments (9)
src-tauri/src/engine/stream_proxy.rs (1)

30-32: LGTM!

Also applies to: 778-790, 939-962, 998-1005, 1153-1153, 1414-1449, 1756-1794

src/hooks/useStreamPlayer.ts (6)

107-112: LGTM!


193-215: LGTM!


275-278: LGTM!


1233-1307: LGTM!


1309-1403: LGTM!


1511-1542: LGTM!

tests/useStreamPlayer.test.ts (2)

11-11: LGTM!


66-104: LGTM!

Comment thread src-tauri/src/engine/stream_proxy.rs Outdated
Comment thread src/hooks/useStreamPlayer.ts Outdated
@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@kristofferR

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 2141811c55

ℹ️ 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 src/hooks/useStreamPlayer.ts

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src-tauri/src/engine/stream_proxy.rs (1)

975-987: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Preserve the steady-state deadline across empty chunks.

After the first non-empty chunk, every stream.next() call receives a fresh steady_read_timeout. Because empty chunks are skipped with continue, periodic empty frames can keep a stalled stream alive indefinitely and bypass the intended steady-state timeout. Track a fixed steady deadline and reset it only after forwarding non-empty data.

Proposed fix
-        let mut received_data = false;
+        let mut steady_deadline = None;
         let startup_deadline = tokio::time::Instant::now() + startup_read_timeout;
         loop {
-            let next_chunk = if received_data {
-                tokio::time::timeout(steady_read_timeout, stream.next()).await
+            let next_chunk = if let Some(deadline) = steady_deadline {
+                tokio::time::timeout_at(deadline, stream.next()).await
             } else {
                 tokio::time::timeout_at(startup_deadline, stream.next()).await
             };
@@
-                    received_data = true;
                     let permits = chunk.len().min(STREAM_PROXY_READ_AHEAD_BYTES) as u32;
@@
                     if chunk_tx.send((chunk, permit)).await.is_err() {
                         return StreamForwardOutcome::DownstreamClosed;
                     }
+                    steady_deadline =
+                        Some(tokio::time::Instant::now() + steady_read_timeout);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src-tauri/src/engine/stream_proxy.rs` around lines 975 - 987, Update the
stream read loop containing received_data and startup_deadline to track a fixed
steady-state deadline rather than recreating steady_read_timeout for each
stream.next() call. Keep the deadline unchanged when empty chunks are skipped,
and reset it only after successfully forwarding a non-empty chunk; preserve the
startup deadline behavior before the first non-empty chunk.
src/hooks/useStreamPlayer.ts (1)

1238-1247: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Route initialization errors must resolve through the shared failure path.

The fallback orchestration calls tryHlsPlayback / tryMpegtsPlayback directly, so rejections before the existing try/catch blocks skip recovery/fallback attempts. Wrap the early initialization and event registration for both routes inside the same failure fail() path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/useStreamPlayer.ts` around lines 1238 - 1247, Ensure both
tryHlsPlayback and tryMpegtsPlayback route initialization and event-registration
failures through their existing shared fail() path, including dynamic imports,
support checks, and player construction. Update the HLS flow at
src/hooks/useStreamPlayer.ts lines 1238-1247 and the MPEG-TS flow at
src/hooks/useStreamPlayer.ts lines 1315-1339; preserve normal successful
playback and existing fallback behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src-tauri/src/engine/stream_proxy.rs`:
- Around line 975-987: Update the stream read loop containing received_data and
startup_deadline to track a fixed steady-state deadline rather than recreating
steady_read_timeout for each stream.next() call. Keep the deadline unchanged
when empty chunks are skipped, and reset it only after successfully forwarding a
non-empty chunk; preserve the startup deadline behavior before the first
non-empty chunk.

In `@src/hooks/useStreamPlayer.ts`:
- Around line 1238-1247: Ensure both tryHlsPlayback and tryMpegtsPlayback route
initialization and event-registration failures through their existing shared
fail() path, including dynamic imports, support checks, and player construction.
Update the HLS flow at src/hooks/useStreamPlayer.ts lines 1238-1247 and the
MPEG-TS flow at src/hooks/useStreamPlayer.ts lines 1315-1339; preserve normal
successful playback and existing fallback behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3601a926-67d4-4cac-b626-024d8e69dbfd

📥 Commits

Reviewing files that changed from the base of the PR and between eda0d3b and 2141811.

📒 Files selected for processing (2)
  • src-tauri/src/engine/stream_proxy.rs
  • src/hooks/useStreamPlayer.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: Build (macos-latest)
  • GitHub Check: Build (windows-latest)
  • GitHub Check: Parser Fuzz Smoke
  • GitHub Check: Build (ubuntu-22.04)
  • GitHub Check: Build (windows-latest)
🧰 Additional context used
📓 Path-based instructions (5)
src-tauri/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Use Rust conventions: snake_case naming, 4-space indentation, thiserror for error types, and serde for serialization.

Files:

  • src-tauri/src/engine/stream_proxy.rs
src-tauri/src/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

src-tauri/src/**/*.rs: Keep backend responsibilities organized into models, engine, commands, state.rs, error.rs, and lib.rs according to their documented roles.
Use event-driven scanning: emit scan://channel-result events per channel, with frontend event updates batched using requestAnimationFrame.

Files:

  • src-tauri/src/engine/stream_proxy.rs
src-tauri/src/engine/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Place core IPTV processing logic, including parsing, checking, ffmpeg, proxy, and resume functionality, in the engine module.

Files:

  • src-tauri/src/engine/stream_proxy.rs
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Define agent interfaces and implementations in TypeScript for agent systems
Use clear naming conventions for agent classes and methods
Document agent behavior and responsibilities in comments or docstrings
Implement error handling in agent methods

Files:

  • src/hooks/useStreamPlayer.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use strict TypeScript with no unused locals or parameters.

Files:

  • src/hooks/useStreamPlayer.ts
🔇 Additional comments (6)
src-tauri/src/engine/stream_proxy.rs (1)

30-32: LGTM!

Also applies to: 778-790, 940-962, 1154-1154, 1412-1416, 1448-1450, 1758-1794

src/hooks/useStreamPlayer.ts (5)

107-112: LGTM!

Also applies to: 193-215


1212-1218: LGTM!

Also applies to: 1232-1237, 1250-1258, 1266-1291


1309-1314: LGTM!

Also applies to: 1342-1370, 1372-1387


1486-1498: LGTM!

Also applies to: 1511-1534, 1544-1559, 1562-1574


275-278: 🩺 Stability & Availability

No need to change the aggregate loading budget.

LOADING_TIMEOUT_MS is 75s, while the non-HLS fallback path has a maximum sequential route budget of 65s (two MPEG-TS routes at 15s each, Xtream HLS at 15s, and native playback at 15s), leaving 10s for initialization and startup overhead.

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@kristofferR

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: be28ba75bb

ℹ️ 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 src/hooks/useStreamPlayer.ts
@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@kristofferR

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/useStreamPlayer.ts (1)

1314-1333: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Propagate the stream’s live/VOD mode into mpegts.js.

getMpegtsPlaybackRoutes receives isLive, but tryMpegtsPlayback still creates the player with isLive: true. VOD MPEG-TS routes should use isLive: false so mpegts.js applies standard VOD buffering instead of live stream behavior.

Proposed fix
-      signal: AbortSignal,
+      signal: AbortSignal,
+      isLive: boolean,
       timeoutMs = MPEGTS_PLAYBACK_ROUTE_TIMEOUT_MS,
@@
-              isLive: true,
+              isLive,
@@
-          const mpegtsOk = await tryMpegtsPlayback(route.url, abortController.signal);
+          const mpegtsOk = await tryMpegtsPlayback(
+            route.url,
+            abortController.signal,
+            result.content_type === "live",
+          );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/useStreamPlayer.ts` around lines 1314 - 1333, Update
tryMpegtsPlayback to accept the stream’s isLive value and pass it to
mpegts.createPlayer instead of hardcoding isLive: true. Propagate the existing
isLive argument from getMpegtsPlaybackRoutes through every tryMpegtsPlayback
call, preserving live behavior while enabling standard VOD buffering.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/hooks/useStreamPlayer.ts`:
- Around line 1314-1333: Update tryMpegtsPlayback to accept the stream’s isLive
value and pass it to mpegts.createPlayer instead of hardcoding isLive: true.
Propagate the existing isLive argument from getMpegtsPlaybackRoutes through
every tryMpegtsPlayback call, preserving live behavior while enabling standard
VOD buffering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a62e7732-af40-4621-b0e0-68eb407541fc

📥 Commits

Reviewing files that changed from the base of the PR and between be28ba7 and c348266.

📒 Files selected for processing (1)
  • src/hooks/useStreamPlayer.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (6)
  • GitHub Check: Build (windows-latest)
  • GitHub Check: Build (windows-latest)
  • GitHub Check: Build (macos-latest)
  • GitHub Check: Build (ubuntu-22.04)
  • GitHub Check: Rust Tests
  • GitHub Check: Parser Fuzz Smoke
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Define agent interfaces and implementations in TypeScript for agent systems
Use clear naming conventions for agent classes and methods
Document agent behavior and responsibilities in comments or docstrings
Implement error handling in agent methods

Files:

  • src/hooks/useStreamPlayer.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use strict TypeScript with no unused locals or parameters.

Files:

  • src/hooks/useStreamPlayer.ts
🔇 Additional comments (1)
src/hooks/useStreamPlayer.ts (1)

109-112: LGTM!

Also applies to: 193-215, 278-279, 1214-1214, 1233-1312, 1334-1412, 1498-1503, 1514-1514, 1560-1590

@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: c34826646f

ℹ️ 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 src/hooks/useStreamPlayer.ts Outdated
@kristofferR

Copy link
Copy Markdown
Owner Author

@codex review

1 similar comment
@kristofferR

Copy link
Copy Markdown
Owner Author

@codex review

@kristofferR

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 5d3861dea5

ℹ️ 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".

@kristofferR
kristofferR merged commit bd432d5 into main Jul 23, 2026
9 checks passed
@kristofferR
kristofferR deleted the fix/issue-211-playback-timeouts branch July 23, 2026 23:03
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