diff --git a/android/app/src/main/kotlin/com/edde746/plezy/mpv/MpvPlayerCore.kt b/android/app/src/main/kotlin/com/edde746/plezy/mpv/MpvPlayerCore.kt index ec2c93e1..357cb9d4 100644 --- a/android/app/src/main/kotlin/com/edde746/plezy/mpv/MpvPlayerCore.kt +++ b/android/app/src/main/kotlin/com/edde746/plezy/mpv/MpvPlayerCore.kt @@ -308,6 +308,12 @@ class MpvPlayerCore private constructor( // Pause on the last frame at EOF instead of unloading the file, so a // seek after the video ends still works (matches Linux/Windows). setOption("keep-open", "yes") + // Plezy only ever opens media-server streams and local files, so + // mpv's bundled ytdl_hook has nothing to resolve: it costs an + // on_load hook per open and, on a failed open, spawns yt-dlp with + // the access token in its argv. mpv decides whether to load the + // builtin script during mpv_initialize, hence an option here. + setOption("ytdl", "no") } if (displayFpsOverride != null) { Log.d(TAG, "Initial display-fps-override=$displayFpsOverride") diff --git a/linux/runner/mpv/mpv_player.cc b/linux/runner/mpv/mpv_player.cc index cc7ab232..085f4a0d 100644 --- a/linux/runner/mpv/mpv_player.cc +++ b/linux/runner/mpv/mpv_player.cc @@ -346,6 +346,13 @@ bool MpvPlayer::Initialize() { mpv_set_option_string(mpv_, "input-vo-keyboard", "no"); mpv_set_option_string(mpv_, "osc", "no"); mpv_set_option_string(mpv_, "terminal", "no"); + // Every URL Plezy opens is a media-server stream or a local file, never a + // site mpv's bundled ytdl_hook could resolve. Loading it costs an on_load + // hook per open and, on a failed open, spawns yt-dlp with the full stream + // URL — access token included — in its argv, where /proc exposes it. mpv + // gates loading the builtin script on this option at mpv_initialize time, + // so it has to be set here rather than from Dart. + mpv_set_option_string(mpv_, "ytdl", "no"); // Default to warn-level logging mpv_request_log_messages(mpv_, "warn"); diff --git a/windows/runner/mpv/mpv_player.cpp b/windows/runner/mpv/mpv_player.cpp index 591999d7..beb82acd 100644 --- a/windows/runner/mpv/mpv_player.cpp +++ b/windows/runner/mpv/mpv_player.cpp @@ -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.