Skip to main content

## PlayerStatusEvent

# Enum PlayerStatusEvent

Source

    pub enum PlayerStatusEvent {
    Show 18 variants    PositionUpdate {
            position: f64,
            duration: f64,
        },
        StateChanged {
            state: String,
            media_id: Option<String>,
        },
        MediaLoaded {
            duration: f64,
        },
        PlaybackEnded,
        Buffering {
            percent: u8,
        },
        Error {
            message: String,
            recoverable: bool,
        },
        VolumeChanged {
            volume: f32,
            muted: bool,
        },
        SleepTimerChanged {
            mode: SleepTimerMode,
            remaining_seconds: u32,
        },
        SleepTimerExpired,
        ShowNextEpisodePopup {
            current_episode: MediaItem,
            next_episode: MediaItem,
            countdown_seconds: u32,
            auto_advance: bool,
        },
        CountdownTick {
            remaining_seconds: u32,
        },
        QueueChanged {
            items: Vec<MediaItem>,
            current_index: Option<usize>,
            shuffle: bool,
            repeat: RepeatMode,
            has_next: bool,
            has_previous: bool,
        },
        SessionChanged {
            session: MediaSessionType,
        },
        SessionsUpdated {
            sessions: Vec<SessionInfo>,
        },
        PlaybackModeChanged {
            mode: String,
            session_id: Option<String>,
        },
        RemoteDisconnectRequested,
        ControlCommand {
            action: String,
            position: Option<f64>,
        },
        WebviewAudioLoad {
            url: String,
            media_id: Option<String>,
            position: f64,
            autoplay: bool,
        },
    }

Expand description

Events emitted by the player backend to the frontend via Tauri events.

These are distinct from `PlayerEvent` in state.rs, which handles internal state machine transitions.

TRACES: UR-005, UR-019, UR-023, UR-026 | DR-001, DR-028, DR-047

## Variants§

§

### PositionUpdate

Playback position updated (emitted periodically during playback)

#### Fields

§ `position: f64`

Current position in seconds

§ `duration: f64`

Total duration in seconds

§

### StateChanged

Player state changed

#### Fields

§ `state: String`

New state: “playing”, “paused”, “stopped”, “loading”, “idle”

§ `media_id: Option<String>`

ID of the current media item, if any

§

### MediaLoaded

Media has finished loading and is ready to play

#### Fields

§ `duration: f64`

Total duration in seconds

§

### PlaybackEnded

Playback has ended naturally (reached end of media)

§

### Buffering

Buffering state changed

#### Fields

§ `percent: u8`

Buffering progress (0-100)

§

### Error

An error occurred during playback

#### Fields

§ `message: String`

Error message

§ `recoverable: bool`

Whether the error is recoverable

§

### VolumeChanged

Volume changed

#### Fields

§ `volume: f32`

New volume level (0.0-1.0)

§ `muted: bool`

Whether audio is muted

§

### SleepTimerChanged

Sleep timer state changed

#### Fields

§ `mode: SleepTimerMode`

Sleep timer mode

§ `remaining_seconds: u32`

Remaining seconds (for time-based timer)

§

### SleepTimerExpired

Time-based sleep timer expired: playback must stop. The backend stops its own (MPV/ExoPlayer) playback, but HTML5 video on Linux plays in the webview outside the backend’s control — the frontend pauses it on this event.

§

### ShowNextEpisodePopup

Show next episode popup with countdown

#### Fields

§ `current_episode: MediaItem`

Current episode that just finished

§ `next_episode: MediaItem`

Next episode to play

§ `countdown_seconds: u32`

Countdown duration in seconds

§ `auto_advance: bool`

Whether to auto-advance when countdown reaches 0

§

### CountdownTick

Countdown tick (emitted every second during autoplay countdown)

#### Fields

§ `remaining_seconds: u32`

Remaining seconds in countdown

§

### QueueChanged

Queue changed (items added, removed, reordered, or playback mode changed)

#### Fields

§ `items: Vec<MediaItem>`

All items in the queue

§ `current_index: Option<usize>`

Current item index

§ `shuffle: bool`

Whether shuffle is enabled

§ `repeat: RepeatMode`

Current repeat mode

§ `has_next: bool`

Whether there’s a next track available

§ `has_previous: bool`

Whether there’s a previous track available

§

### SessionChanged

Media session changed (activity context changed: Audio/Movie/TvShow/Idle)

#### Fields

§ `session: MediaSessionType`

Current session state

§

### SessionsUpdated

Remote sessions updated (for cast/remote control UI)

#### Fields

§ `sessions: Vec<SessionInfo>`

All active controllable sessions from Jellyfin

§

### PlaybackModeChanged

The authoritative playback mode changed in the Rust backend.

The Rust `PlaybackModeManager` is the single source of truth for which device playback commands route to (local vs a remote session). The frontend keeps a mirror store for the UI; without this event that mirror drifts out of sync (e.g. a mode transition happens inside a transfer or a local stop that the frontend never learns about), and controls then route to the wrong device — the classic “it keeps playing on the remote” bug. The frontend reconciles its store to this payload whenever it fires.

#### Fields

§ `mode: String`

New mode: “local”, “remote”, or “idle”.

§ `session_id: Option<String>`

Session id when `mode == "remote"`, otherwise `None`.

§

### RemoteDisconnectRequested

The user asked to disconnect from the remote session and resume locally.

Emitted when the lockscreen Stop button is pressed while casting. The frontend owns the two-step remote->local transfer (it must reload the media item locally), so the native side only signals intent here.

§

### ControlCommand

Backend-originated control command targeting the active frontend player adapter (the HTML5 that lives in the webview, which Rust cannot drive directly). Emitted by control paths like the sleep timer, lockscreen, or remote so they can pause/play/seek/stop the webview element. `playerEvents.ts` routes this to the active PlayerAdapter via the facade.

#### Fields

§ `action: String`

One of: “play”, “pause”, “stop”, “seek”.

§ `position: Option<f64>`

Target position in seconds (only meaningful for “seek”).

§

### WebviewAudioLoad

Ask the frontend webview `<audio>` element to load and play a stream.

Emitted by `WebviewAudioBackend` on platforms with no native audio backend (e.g. Windows): audio-only playback is rendered by an `<audio>` element in the webview, mirroring how all video already renders through the webview `<video>`. The element then reports its state/position back through the `player_report_*` commands, so the Rust controller stays the single source of truth. Subsequent play/pause/seek/stop reach the element via `ControlCommand`.

#### Fields

§ `url: String`

Stream URL for the `<audio>` element to play.

§ `media_id: Option<String>`

Jellyfin item id, used as the media_id when reporting state back.

§ `position: f64`

Resume position in seconds (0 = start from the beginning).

§ `autoplay: bool`

Whether to begin playing immediately after loading.

## Trait Implementations§

Source §

### impl Clone for PlayerStatusEvent

Source §

#### fn clone(&self) -> PlayerStatusEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source §

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more
Source §

### impl Debug for PlayerStatusEvent

Source §

#### fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source §

### impl<'de> Deserialize<'de> for PlayerStatusEvent

Source §

#### fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source §

### impl Event for PlayerStatusEvent

Source §

#### const NAME: &'static str = "player-status-event"

The unique name for this event. Derived from the struct’s name via the `Event` derive macro.
§

#### fn listen<F, R, H>(handle: &H, handler: F) -> u32
where R: Runtime, H: Listener<R> + Manager<R>, F: Fn(TypedEvent<Self>) + Send + 'static, Self: DeserializeOwned,

Listen to an emitted event on this manager.
§

#### fn listen_any<F, R, H>(handle: &H, handler: F) -> u32
where R: Runtime, H: Listener<R> + Manager<R>, F: Fn(TypedEvent<Self>) + Send + 'static, Self: DeserializeOwned,

Listen to an emitted event to any target.
§

#### fn once<F, R, H>(handle: &H, handler: F) -> u32
where R: Runtime, H: Listener<R> + Manager<R>, F: FnOnce(TypedEvent<Self>) + Send + 'static, Self: DeserializeOwned,

Listen to an event on this manager only once.
§

#### fn once_any<F, R, H>(handle: &H, handler: F) -> u32
where R: Runtime, H: Listener<R> + Manager<R>, F: FnOnce(TypedEvent<Self>) + Send + 'static, Self: DeserializeOwned,

Listens once to an emitted event to any target . Read more
§

#### fn emit<R, H>(&self, handle: &H) -> Result<(), Error>
where R: Runtime, H: Emitter<R> + Manager<R>, Self: Serialize + Clone,

Emits an event to all targets.
§

#### fn emit_to<R, H, I>(&self, handle: &H, target: I) -> Result<(), Error>
where R: Runtime, H: Emitter<R> + Manager<R>, I: Into<EventTarget>, Self: Serialize + Clone,

Emits an event to all targets matching the given target.
§

#### fn emit_filter<F, R, H>(&self, handle: &H, filter: F) -> Result<(), Error>
where R: Runtime, H: Emitter<R> + Manager<R>, F: Fn(&EventTarget) -> bool, Self: Serialize + Clone,

Emits an event to all targets based on the given filter.
Source §

### impl NamedType for PlayerStatusEvent

Source §

#### fn sid() -> SpectaID

Source §

#### fn named_data_type( type_map: &mut TypeCollection, generics: &[DataType], ) -> NamedDataType

this is equivalent to [Type::inline] but returns a [NamedDataType] instead.
Source §

#### fn definition_named_data_type(type_map: &mut TypeCollection) -> NamedDataType

this is equivalent to [Type::definition] but returns a [NamedDataType] instead.
Source §

### impl Serialize for PlayerStatusEvent

Source §

#### fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source §

### impl Type for PlayerStatusEvent

Source §

#### fn inline(type_map: &mut TypeCollection, generics: Generics<'_>) -> DataType

Returns the definition of a type using the provided generics. Read more
Source §

#### fn reference(type_map: &mut TypeCollection, generics: &[DataType]) -> Reference

Generates a datatype corresponding to a reference to this type, as determined by its category. Getting a reference to a type implies that it should belong in the type map (since it has to be referenced from somewhere), so the output of `definition` will be put into the type map.
Source §

### impl Flatten for PlayerStatusEvent

## Auto Trait Implementations§

§

### impl Freeze for PlayerStatusEvent

§

### impl RefUnwindSafe for PlayerStatusEvent

§

### impl Send for PlayerStatusEvent

§

### impl Sync for PlayerStatusEvent

§

### impl Unpin for PlayerStatusEvent

§

### impl UnsafeUnpin for PlayerStatusEvent

§

### impl UnwindSafe for PlayerStatusEvent

## Blanket Implementations§

Source §

### impl<T> Any for T
where T: 'static + ?Sized,

Source §

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
Source §

### impl<T> Borrow<T> for T
where T: ?Sized,

Source §

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source §

### impl<T> BorrowMut<T> for T
where T: ?Sized,

Source §

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source §

### impl<T> CloneToUninit for T
where T: Clone,

Source §

#### unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (`clone_to_uninit`)
Performs copy-assignment from `self` to `dest`. Read more
§

### impl<'de, D, R> CommandArg<'de, R> for D
where D: Deserialize<'de>, R: Runtime,

§

#### fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>

Derives an instance of `Self` from the [`CommandItem`]. Read more
Source §

### impl<T> From<T> for T

Source §

#### fn from(t: T) -> T

Returns the argument unchanged.

§

### impl<T> FunctionArg for T
where T: Type,

§

#### fn to_datatype(type_map: &mut TypeCollection) -> Option<DataType>

Gets the type of an argument as a [`DataType`]. Read more
§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
Source §

### impl<T, U> Into<U> for T
where U: From<T>,

Source §

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

§

### impl<T> IpcResponse for T
where T: Serialize,

§

#### fn body(self) -> Result<InvokeResponseBody, Error>

Resolve the IPC response body.
§

### impl<T> PolicyExt for T
where T: ?Sized,

§

#### fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new `Policy` that returns [`Action::Follow`] only if `self` and `other` return `Action::Follow`. Read more
§

#### fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new `Policy` that returns [`Action::Follow`] if either `self` or `other` returns `Action::Follow`. Read more
Source §

### impl<T> Same for T

Source §

#### type Output = T

Should always be `Self`
§

### impl<T> ScopeObject for T
where T: Send + Sync + Debug + DeserializeOwned + 'static,

§

#### type Error = Error

The error type.
§

#### fn deserialize<R>( _app: &AppHandle<R>, raw: Value, ) -> Result<T, <T as ScopeObject>::Error>
where R: Runtime,

Deserialize the raw scope value.
Source §

### impl<T> Serialize for T
where T: Serialize + ?Sized,

Source §

#### fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source §

#### fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source §

### impl<T> ToOwned for T
where T: Clone,

Source §

#### type Owned = T

The resulting type after obtaining ownership.
Source §

#### fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source §

#### fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source §

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source §

#### type Error = Infallible

The type returned in the event of a conversion error.
Source §

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source §

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source §

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source §

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
Source §

### impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

### impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,