diff --git a/.changes/embedded-mpv-no-ytdl-hook.md b/.changes/embedded-mpv-no-ytdl-hook.md new file mode 100644 index 000000000..273e28c7d --- /dev/null +++ b/.changes/embedded-mpv-no-ytdl-hook.md @@ -0,0 +1,10 @@ +--- +type: fix +area: embedded-mpv +--- + +When a stream refuses the connection, the embedded MPV player (frame-copy +engine) no longer hands the URL to yt-dlp before giving up: the failure +shows up right away and its error no longer reads "youtube-dl failed: +unexpected error occurred", matching the native-view engines and the +external MPV player. diff --git a/apps/electron-backend/native/helper/mpv_frame_helper.cpp b/apps/electron-backend/native/helper/mpv_frame_helper.cpp index 204de5b27..2eebca748 100644 --- a/apps/electron-backend/native/helper/mpv_frame_helper.cpp +++ b/apps/electron-backend/native/helper/mpv_frame_helper.cpp @@ -834,6 +834,12 @@ int main(int argc, char** argv) { mpv_set_option_string(g_state.mpv, "idle", "yes"); mpv_set_option_string(g_state.mpv, "input-default-bindings", "no"); mpv_set_option_string(g_state.mpv, "osc", "no"); + /* Keep parity with the native-view addons and the external MPV launch + * path: with mpv's youtube-dl hook enabled, a refused HTTP open falls + * through to yt-dlp and the session error reads "youtube-dl failed" + * instead of the load error. A user `ytdl=yes` session option + * (applied below, before mpv_initialize) still overrides it. */ + mpv_set_option_string(g_state.mpv, "ytdl", "no"); if (!args.audioDelay.empty()) { /* Compensates the frame-copy video-path latency to restore * lip-sync; calibrated per platform, see the architecture doc. */ diff --git a/docs/architecture/embedded-mpv-native.md b/docs/architecture/embedded-mpv-native.md index df7135415..c85ddafeb 100644 --- a/docs/architecture/embedded-mpv-native.md +++ b/docs/architecture/embedded-mpv-native.md @@ -539,6 +539,17 @@ user line overrides both: | Linux native-view | written to a user-only (0600) config file under `userData/embedded-mpv/options-/` and referenced as `--include=` on the `mpv --wid` command line (before the per-playback options, so a playlist's user-agent/headers still win); the file is removed on dispose, the instance directory on shutdown, and another instance's leftovers only once its process is gone (two instances may share one `userData`) | | Frame-copy helper | the first stdin line (`mpv-options`, helper started with `--mpv-options-stdin`), applied after the helper's built-in block | +The helper's own built-in block is `vo=libmpv`, the session's `hwdec`, +`keep-open=yes`, `idle=yes`, `input-default-bindings=no`, `osc=no` and +`ytdl=no`. The last one keeps parity with the native-view addons and the +external MPV launch path (`--ytdl=no` in `mpv-session.service.ts`): with +mpv's youtube-dl hook enabled, a refused HTTP open falls through to yt-dlp +before it fails, which delays the `error` transition and can leave the +session error reading `youtube-dl failed: unexpected error occurred` +instead of the load error (the helper stores every error-level libmpv log +line as the snapshot error, so whichever line lands last wins). A user +`ytdl=yes` line overrides it like every other built-in. + The list never appears on a command line: an option such as `http-header-fields=Authorization: …` would otherwise be readable by every local user through `ps` / `/proc//cmdline`.