fix(mpv): stop loading the ytdl hook for media-server streams
Every URL the player opens is a media-server stream or a local file, so mpv's bundled ytdl_hook has nothing to resolve. It still ran an on_load hook per open and, whenever an open failed, spawned yt-dlp with the full stream URL in its argv — access token included, readable through /proc on Linux. It also added ~700ms to every failed open and buried the real "[stream] Failed to open" line under three ytdl_hook errors. mpv decides whether to load the builtin script inside mpv_initialize, so this has to be an option set beforehand rather than a property set from Dart. Verified against mpv 0.41: --ytdl=yes logs "Loading lua script @ytdl_hook.lua", --ytdl=no never loads it. Apple is deliberately excluded: the bundled libmpv is built without Lua, so the option does not exist there and setting it would only print an mpv error on every player init.
This commit is contained in:
@@ -570,6 +570,12 @@ bool MpvPlayer::Initialize(HWND view) {
|
||||
// mpv's default handling would double-handle Play/Pause.
|
||||
mpv_set_option_string(mpv_, "input-media-keys", "no");
|
||||
mpv_set_option_string(mpv_, "osc", "no");
|
||||
// Never resolve URLs through mpv's bundled ytdl_hook: Plezy only ever opens
|
||||
// media-server streams and local files, the hook adds a per-open on_load
|
||||
// round trip, and on a failed open it spawns yt-dlp with the access token in
|
||||
// its argv. mpv decides whether to load the builtin script during
|
||||
// mpv_initialize, so this must be an option, not a Dart setProperty.
|
||||
mpv_set_option_string(mpv_, "ytdl", "no");
|
||||
|
||||
if (!audio_only_) {
|
||||
// Let mpv use display/context detection instead of forcing HDR signaling.
|
||||
|
||||
Reference in New Issue
Block a user