Expand description
Leptos-side bindings for the screen-app player IPC.
Three responsibilities:
- Mirror the Rust-side
screen_app::player_session::PlayerStatuspayload (kept in sync manually — they must match theSerialize/Deserializeshape on both ends). The link is deliberately plain text:app-uiis a WASM crate and can’t depend onscreen-app(Tauri-native), so the type can’t be resolved by rustdoc. - Expose
extern "C"thin Rust wrappers around the JS helpers__screenOpen/__screenPlay/__screenPausedeclared inindex.html. Returns areResult<JsValue, JsValue>(catch-style) so the calls degrade to no-ops when running outside Tauri. install_player_status_listenerwires aplayer-statusbrowser-CustomEventlistener and pushes the parsed payload into a LeptosWriteSignal<PlayerStatus>.
Structs§
- Player
Status - IPC-stable mirror of
screen_app::player_session::PlayerStatus.
Enums§
- Session
State - IPC-stable mirror of
screen_app::player_session::SessionState(plain-text reference — see the crate-level docs for why).serde(rename_all = "lowercase")matches the Rust-side serialization.
Functions§
- convert_
file_ src - Convert a local file path to an asset-protocol URL the
<video>element can load. ReturnsNonewhen running outside Tauri (the standalonetrunk servebrowser-only path) — callers can render a placeholder in that case. - duration_
seconds - Total duration in seconds. Falls back to
60.0(matches thePlayerControlscomponent’s own fallback) when not reported. - fraction_
ms 🔒 - install_
player_ status_ listener - Install a
player-statusbrowser-CustomEventlistener. - ms_
to_ 🔒seconds - position
- Position fraction
0.0..=1.0from elapsed/duration. Returns0.0when duration is unknown or zero. - screen_
convert_ file_ src_ js - Synchronous Tauri helper: convert a local file path into the
asset-protocol URL the webview can load via
<video src>. Returns the converted string as aJsValue, orJsValue::UNDEFINEDwhen running outside Tauri. - screen_
open - Open a file. Bridge throws if
__TAURI__is unavailable (browser-onlytrunk servepath) — we ignore the error. - screen_
pause - Pause playback.
- screen_
play - Resume playback.