pub struct PlayerSession {
app: Application,
inner: Mutex<Option<Inner>>,
}Expand description
Tauri shell’s player state. Shared via tauri::State<PlayerSession>.
Fields§
§app: Application§inner: Mutex<Option<Inner>>Implementations§
Source§impl PlayerSession
impl PlayerSession
Sourcepub fn new() -> Self
pub fn new() -> Self
Boot the session — builds a [wisp::application::Application]
up-front so subsequent open calls don’t pay device-init latency.
§Panics
Panics if no compatible GPU adapter is available. The recorder can’t function without one, so failing fast is preferable to surfacing a deferred error through the IPC layer.
Sourcepub fn open(&self, path: &Path) -> Result<PlayerStatus, String>
pub fn open(&self, path: &Path) -> Result<PlayerStatus, String>
Open a video file. Replaces any currently-loaded session.
Returns the fresh PlayerStatus (the new session begins in
SessionState::Paused).
§Errors
Returns an error string if the file can’t be opened (missing, unreadable, unsupported codec). The error is surfaced to the webview so the UI can show a toast.
Sourcepub fn play(&self)
pub fn play(&self)
Transition to SessionState::Playing. No-op when empty or
already playing.
Sourcepub fn pause(&self)
pub fn pause(&self)
Transition to SessionState::Paused. No-op when empty.
Sourcepub fn tick(&self) -> u32
pub fn tick(&self) -> u32
Drive the player by the wallclock delta since the last tick.
Returns the number of frames the player uploaded. 0 when the
session is empty, paused, ended, or no new frame was due.
Sourcepub fn status(&self) -> PlayerStatus
pub fn status(&self) -> PlayerStatus
Snapshot of the current status. Cheap — no decoding work.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PlayerSession
impl !RefUnwindSafe for PlayerSession
impl Send for PlayerSession
impl Sync for PlayerSession
impl Unpin for PlayerSession
impl UnsafeUnpin for PlayerSession
impl !UnwindSafe for PlayerSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().