Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

fix(player): pass custom headers via ytdl-raw-options-append to fix dash playback

Samir Hossains8000412ecce4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 697da0d..bae6c02 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,8 +3,9 @@
## [Unreleased]
### Fixed
-- **MPV Player Header Flag Construction**:
- - Removed redundant `--ytdl-raw-options` header pass-through in `src/player.rs`, preventing option parsing aborts (exit code 1) caused by unescaped commas inside standard browser `User-Agent` strings.
+- **MPV Player Header & Cookie Flag Construction**:
+ - Replaced comma-joined `--ytdl-raw-options` header strings in `src/player.rs` with dedicated `--ytdl-raw-options-append` arguments for non-UA/referer headers (e.g. CloudFront `Cookie`).
+ - Preserved native `--user-agent` and `--referrer` flags, eliminating `mpv` option parsing aborts (code 1) from commas inside browser User-Agent strings while ensuring DASH manifest requests receive authentication cookies (preventing code 2 playback errors).
## [0.1.22] - 2026-09-21
### Added
diff --git a/docs/players.md b/docs/players.md
index 76e72d1..d2fa20a 100644
--- a/docs/players.md
+++ b/docs/players.md
@@ -30,7 +30,7 @@ by the image picker, then clamped to a fixed range.
Playback sources (for example 4KHD and MovieBox) may carry `Referer`/`User-Agent` headers.
MovieBox DASH streams additionally carry signed `Cookie` headers for CloudFront authentication.
-- mpv and IINA send headers via native CLI flags (`--user-agent`, `--referrer`, and `--http-header-fields`), which are read by demuxers and automatically forwarded by internal Lua hooks to yt-dlp.
+- mpv and IINA send headers via native CLI flags (`--user-agent`, `--referrer`, and `--http-header-fields`), and forward custom auth cookies via `--ytdl-raw-options-append` to yt-dlp hooks for DASH manifests.
while VLC maps them to `--http-referrer` / `--http-user-agent`. Android intent playback forwards `Referer`/`User-Agent` extras when using `am`/`termux-am`, and supports unauthenticated streams (CircleFTP, DhakaFlix, IPTV) and CDN streams natively.
The `supports_headers` gate in `app/playback.rs` validates whether a player can satisfy required stream headers. For VLC and Android Intent, signed CloudFront `Cookie` streams (such as MovieBox DASH manifests) are automatically supported via the detached loopback sidecar proxy (`--proxy-for-vlc`). The proxy injects the signed CloudFront cookies and auth headers server-side and streams chunks directly over localhost.
## Subtitles
diff --git a/src/player.rs b/src/player.rs
index 972177f..c041106 100644
--- a/src/player.rs
+++ b/src/player.rs
@@ -443,6 +443,9 @@ fn mpv_command(
for (name, value) in headers {
if !name.eq_ignore_ascii_case("user-agent") && !name.eq_ignore_ascii_case("referer") {
command.arg(format!("{prefix}http-header-fields={name}: {value}"));
+ command.arg(format!(
+ "{prefix}ytdl-raw-options-append=add-header={name}:{value}"
+ ));
}
}
}
@@ -1638,6 +1641,10 @@ mod tests {
args.iter()
.any(|a| a == "--http-header-fields=Cookie: auth=token123")
);
+ assert!(
+ args.iter()
+ .any(|a| a == "--ytdl-raw-options-append=add-header=Cookie:auth=token123")
+ );
assert!(!args.iter().any(|a| a.starts_with("--ytdl-raw-options=")));
}