fix #14740: serve playback only to the main window
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,6 @@ use std::time::Duration;
|
||||
use recorder_core::call_view::{CallDetail, CallListItem};
|
||||
use recorder_core::capture::Devices;
|
||||
use recorder_core::model::CallId;
|
||||
use recorder_core::playback::PlaybackInfo;
|
||||
use recorder_core::secrets::Service;
|
||||
use recorder_core::settings::Settings;
|
||||
use serde::Serialize;
|
||||
@@ -20,7 +19,8 @@ use tauri_plugin_autostart::ManagerExt;
|
||||
|
||||
use crate::processing;
|
||||
use crate::state::{
|
||||
AppState, CallBrief, DeviceLevels, DiscardError, Ended, PendingPrompt, RecordingState,
|
||||
AppState, CallBrief, DeviceLevels, DiscardError, Ended, PendingPrompt, PreparedPlayback,
|
||||
RecordingState,
|
||||
};
|
||||
|
||||
const LEVELS_INTERVAL: Duration = Duration::from_millis(100);
|
||||
@@ -210,12 +210,24 @@ pub fn rename_call(
|
||||
}
|
||||
|
||||
/// Mixes the call's two tracks into one file to play in the detail view
|
||||
/// (or reuses the cached mix); the UI plays it through the asset protocol.
|
||||
/// (or reuses the cached mix); the main window plays it from the
|
||||
/// `playback` scheme ([`crate::playback`]).
|
||||
#[tauri::command]
|
||||
pub async fn prepare_playback(app: AppHandle, id: CallId) -> CmdResult<PlaybackInfo> {
|
||||
pub async fn prepare_playback(app: AppHandle, id: CallId) -> CmdResult<PreparedPlayback> {
|
||||
blocking(app, move |app| app.state::<AppState>().prepare_playback(id)).await
|
||||
}
|
||||
|
||||
/// The player is done with the mix of `lease`: it is removed from disk
|
||||
/// unless a newer player of the same call holds it.
|
||||
#[tauri::command]
|
||||
pub async fn release_playback(app: AppHandle, id: CallId, lease: u64) -> CmdResult<()> {
|
||||
blocking(app, move |app| {
|
||||
app.state::<AppState>().release_playback(id, lease);
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
/// Deletes a finished call's audio and row. Closes the prompt if no call
|
||||
/// waits for it any more; otherwise the prompt reloads and shows the next.
|
||||
/// While its DeepScript jobs are still on record, nothing is deleted and a
|
||||
|
||||
Reference in New Issue
Block a user