ff_preview/event.rs
1//! Player event types emitted by [`PlayerRunner`](crate::playback::player_runner::PlayerRunner).
2
3use std::time::Duration;
4
5/// Events emitted by [`PlayerRunner::run`](crate::playback::player_runner::PlayerRunner::run)
6/// and delivered to callers via
7/// [`PlayerHandle::poll_event`](crate::playback::player_handle::PlayerHandle::poll_event).
8pub enum PlayerEvent {
9 /// A seek initiated via [`PlayerHandle::seek`](crate::playback::player_handle::PlayerHandle::seek)
10 /// has completed.
11 ///
12 /// `pts` is the actual presentation timestamp of the first frame available
13 /// after the seek, which may differ slightly from the requested target due
14 /// to I-frame boundaries.
15 SeekCompleted(Duration),
16
17 /// The media file has been fully decoded; `run()` is about to return.
18 Eof,
19
20 /// Current playback position; emitted once per decoded and presented video frame.
21 ///
22 /// Not emitted during seeking (while [`FrameResult::Seeking`](crate::playback::FrameResult)
23 /// is being returned) — only for fully decoded frames.
24 PositionUpdate(Duration),
25
26 /// A non-fatal decode error encountered by the background decode thread.
27 ///
28 /// Playback continues until EOF; [`PlayerEvent::Eof`] follows shortly after.
29 Error(String),
30}