diff --git a/src-tauri/src/commands/player/mod.rs b/src-tauri/src/commands/player/mod.rs index dcf3ce0c..d916ee15 100644 --- a/src-tauri/src/commands/player/mod.rs +++ b/src-tauri/src/commands/player/mod.rs @@ -714,7 +714,7 @@ pub async fn player_enter_background_audio( // this base to the native player's relative position to get the absolute one. // The controller owns it so a backend-driven advance to the next episode // clears it along with the stream it described. - controller.set_background_audio_base(position_seconds); + controller.enter_background_audio(position_seconds); controller .play_item(media_item) .map_err(|e| e.to_string())?; @@ -753,7 +753,7 @@ pub async fn player_exit_background_audio( // The base offset (handoff position) + native player's relative position = // the absolute position to resume the video at. Zero after a backend-driven // episode advance, whose stream already starts at its own zero. - let base = controller.take_background_audio_base(); + let base = controller.exit_background_audio(); // Capture position into a `let` BEFORE stop() — never hold work across a lock // re-entrant call (deadlock discipline, CLAUDE.md). let relative = controller.position(); diff --git a/src-tauri/src/player/mod.rs b/src-tauri/src/player/mod.rs index 72c4e870..dc0ecd6d 100644 --- a/src-tauri/src/player/mod.rs +++ b/src-tauri/src/player/mod.rs @@ -179,6 +179,17 @@ pub struct PlayerController { // TRACES: UR-040 | DR-052 background_audio_base: Arc>, + // True while a background-audio handoff owns playback: the native audio + // player is the real player and the webview