Playback fix
🏗️ Build and Test JellyTau / Run Tests (push) Successful in 4m28s
Traceability Validation / Check Requirement Traces (push) Successful in 22s
🏗️ Build and Test JellyTau / Build Android APK (push) Successful in 18m37s
Build & Release / Run Tests (push) Successful in 4m12s
Build & Release / Build Linux (push) Successful in 16m20s
Build & Release / Build Android (push) Successful in 18m57s
Build & Release / Create Release (push) Successful in 13s
🏗️ Build and Test JellyTau / Run Tests (push) Successful in 4m28s
Traceability Validation / Check Requirement Traces (push) Successful in 22s
🏗️ Build and Test JellyTau / Build Android APK (push) Successful in 18m37s
Build & Release / Run Tests (push) Successful in 4m12s
Build & Release / Build Linux (push) Successful in 16m20s
Build & Release / Build Android (push) Successful in 18m57s
Build & Release / Create Release (push) Successful in 13s
This commit is contained in:
@@ -247,3 +247,51 @@ pub async fn player_on_playback_ended(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ===== HTML5 video state-report commands =====
|
||||
//
|
||||
// On platforms where video renders in the webview (Linux WebKitGTK HTML5
|
||||
// <video>), the real player lives outside the native backend, so the frontend
|
||||
// HTML5 adapter reports DOM events back through these commands. The controller
|
||||
// re-emits them through the same PlayerStatusEvent pipeline the native backends
|
||||
// use, keeping the Rust controller the single source of truth and the frontend
|
||||
// player store fed from one place (playerEvents.ts) in both modes.
|
||||
|
||||
/// Report an HTML5 <video> state change (playing/paused/loading/stopped/idle).
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn player_report_state(
|
||||
player: State<'_, PlayerStateWrapper>,
|
||||
state: String,
|
||||
media_id: Option<String>,
|
||||
) -> Result<(), String> {
|
||||
let controller = player.0.lock().await;
|
||||
controller.report_html5_state(state, media_id);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Report an HTML5 <video> position tick (seconds). The adapter should throttle
|
||||
/// these to roughly match the native backends' ~250ms cadence.
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn player_report_position(
|
||||
player: State<'_, PlayerStateWrapper>,
|
||||
position: f64,
|
||||
duration: f64,
|
||||
) -> Result<(), String> {
|
||||
let controller = player.0.lock().await;
|
||||
controller.report_html5_position(position, duration);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Report that the HTML5 <video> finished loading and knows its duration.
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn player_report_media_loaded(
|
||||
player: State<'_, PlayerStateWrapper>,
|
||||
duration: f64,
|
||||
) -> Result<(), String> {
|
||||
let controller = player.0.lock().await;
|
||||
controller.report_html5_media_loaded(duration);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user