Skip to content

fix: default preferHls to true on Safari#4236

Open
johnpc wants to merge 3 commits into
TeamPiped:masterfrom
johnpc:fix/safari-prefer-hls-default
Open

fix: default preferHls to true on Safari#4236
johnpc wants to merge 3 commits into
TeamPiped:masterfrom
johnpc:fix/safari-prefer-hls-default

Conversation

@johnpc
Copy link
Copy Markdown
Contributor

@johnpc johnpc commented May 17, 2026

Problem

Safari users get error 3016 (Shaka Player VIDEO_ERROR / PIPELINE_ERROR_DECODE) when playing videos. This happens because:

  1. YouTube no longer provides HLS/DASH manifest URLs (both are null in the API response)
  2. The frontend generates a DASH manifest from individual streams
  3. Safari's MSE implementation has poor DASH support, causing playback to fail

Fix

Detect Safari via user agent and default preferHls to true instead of false. This makes Safari use HLS (which it supports natively) by default, while keeping DASH as the default for Chrome/Firefox where MSE works well.

Users can still override this in Preferences.

Testing

  • Safari 26.3 on macOS: videos now play without error
  • Chrome/Firefox: behavior unchanged (still uses DASH by default)
  • The preference toggle still works to override the default in either direction

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced video streaming compatibility by improving stream format selection to account for browser-specific media support limitations, particularly benefiting Safari users.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0a0b216e-48c5-4f1d-8835-deeef1683de4

📥 Commits

Reviewing files that changed from the base of the PR and between 91289d5 and ea61761.

📒 Files selected for processing (1)
  • src/components/VideoPlayer.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/VideoPlayer.vue

📝 Walkthrough

Walkthrough

VideoPlayer now detects Safari and defaults the HLS preference accordingly. A computed isSafari flag from the user agent replaces the hardcoded false default when determining stream type selection between HLS and DASH in multiple conditional branches.

Changes

Safari-aware HLS preference defaulting

Layer / File(s) Summary
Safari detection and HLS preference defaults
src/components/VideoPlayer.vue
isSafari boolean is computed from navigator.userAgent and replaces the hardcoded false default for getPreferenceBoolean("preferHls", ...) in both the MSE/audioStreams branch and the DASH fallback branch.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 With Safari's quirks now known,
HLS shall be the chosen tone,
No more DASH confusion found,
Just smooth playback all around! 🎬

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: defaulting preferHls to true specifically for Safari browsers to fix playback errors.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/VideoPlayer.vue (1)

604-604: 💤 Low value

Consider adding a comment explaining the Safari detection logic.

The isSafari flag is used consistently in both places to intelligently default HLS preference based on browser detection. This is a good solution to the Safari DASH playback issue.

For future maintainability, consider adding a brief comment above line 590 explaining why Safari needs this special handling (e.g., "Safari has poor MSE/DASH support, default to native HLS playback").

📝 Optional: Add explanatory comment
 const MseSupport = window.MediaSource !== undefined || window.ManagedMediaSource !== undefined;
+// Safari has poor MSE/DASH support; detect it to default preferHls to true
+// Chrome includes "Safari" in UA for compatibility, so exclude "chrome" and "android"
 const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);

Also applies to: 642-642

🤖 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/components/VideoPlayer.vue` at line 604, Add a short explanatory comment
above the Safari detection and HLS preference checks (where isSafari and
getPreferenceBoolean("preferHls", isSafari) are used) stating that Safari has
limited MSE/DASH support so we default to native HLS playback; update both
occurrences that use isSafari (the HLS preference logic and the related
conditional at the other location) to include the same comment so future
maintainers understand why Safari is handled specially.
🤖 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.

Nitpick comments:
In `@src/components/VideoPlayer.vue`:
- Line 604: Add a short explanatory comment above the Safari detection and HLS
preference checks (where isSafari and getPreferenceBoolean("preferHls",
isSafari) are used) stating that Safari has limited MSE/DASH support so we
default to native HLS playback; update both occurrences that use isSafari (the
HLS preference logic and the related conditional at the other location) to
include the same comment so future maintainers understand why Safari is handled
specially.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b1e0273d-b427-4925-9e79-74013727d632

📥 Commits

Reviewing files that changed from the base of the PR and between da7ab35 and 676fd91.

📒 Files selected for processing (1)
  • src/components/VideoPlayer.vue

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/components/VideoPlayer.vue`:
- Line 643: The comment line in VideoPlayer.vue ("// Safari defaults to HLS due
to limited MSE/DASH support (see isSafari above).") is mis-indented and failing
Prettier; fix the indentation/spacing at that line to match project Prettier
rules (use four-space indent or run Prettier) so the line aligns with
surrounding code in the VideoPlayer component and the linter passes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b3ed73e9-49b9-4e23-94eb-6e714529f2ca

📥 Commits

Reviewing files that changed from the base of the PR and between d5bcc23 and 2ec8e99.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/reviewdog.yml
  • src/components/VideoPlayer.vue
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/reviewdog.yml

Comment thread src/components/VideoPlayer.vue Outdated
johnpc added 3 commits May 28, 2026 22:16
Safari has poor DASH/MSE support, causing error 3016 (VIDEO_ERROR /
PIPELINE_ERROR_DECODE) when playing videos via generated DASH manifests.
Since Safari natively supports HLS, default preferHls to true on Safari
while keeping the existing default (false) for other browsers.

Users can still override this in preferences.
@johnpc johnpc force-pushed the fix/safari-prefer-hls-default branch from 91289d5 to ea61761 Compare May 29, 2026 02:17
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