pub struct Player { /* private fields */ }Expand description
A playing file. Lives on the thread that draws it; dropping it stops
the workers and ends its AudioOut.
Implementations§
Source§impl Player
impl Player
Sourcepub fn open(path: &Path, audio: bool) -> Result<(Player, Option<AudioOut>)>
pub fn open(path: &Path, audio: bool) -> Result<(Player, Option<AudioOut>)>
Opens path paused at the start. With audio, the file’s sound is
decoded and the returned AudioOut must be played for the clock
to run; without, it plays silent on the wall clock.
Sourcepub fn open_preview(
path: &Path,
audio: bool,
max_side: u32,
) -> Result<(Player, Option<AudioOut>)>
pub fn open_preview( path: &Path, audio: bool, max_side: u32, ) -> Result<(Player, Option<AudioOut>)>
As Player::open, for a small preview: pictures fit max_side on
their long side, and dropping it never waits for the workers, which
stop after the packet they are on. Opening reads and probes the
file, so it may take a moment; call it off the UI thread (a Player
and its AudioOut can be sent to the thread that draws).
pub fn info(&self) -> &Info
pub fn pause(&mut self)
pub fn toggle(&mut self)
pub fn is_playing(&self) -> bool
Sourcepub fn seek(&mut self, secs: f64)
pub fn seek(&mut self, secs: f64)
Jumps to secs (clamped to the clip): the keyframe before it is
found and decoded forward to the frame at secs.
Sourcepub fn step(&mut self, frames: i32)
pub fn step(&mut self, frames: i32)
Moves frames frames forwards (or backwards when negative) and
pauses. Forward steps take the next decoded frames; backward steps
seek to the earlier frame.
pub fn rate(&self) -> f32
Sourcepub fn set_rate(&mut self, rate: f32)
pub fn set_rate(&mut self, rate: f32)
Changes the speed. The sound is stretched to match and keeps its
pitch, as preservesPitch does in Eagle’s <video>, so the queued
sound is decoded again from here.
Sourcepub fn set_volume(&mut self, volume: f32)
pub fn set_volume(&mut self, volume: f32)
0..=1.
Sourcepub fn set_muted(&mut self, muted: bool)
pub fn set_muted(&mut self, muted: bool)
Muting stops decoding the sound and runs the picture on the wall clock; unmuting decodes it again from the playhead.
pub fn set_looping(&mut self, looping: bool)
pub fn looping(&self) -> bool
Sourcepub fn current_time(&self) -> f64
pub fn current_time(&self) -> f64
The playhead in seconds.
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Call every frame: at the end of the clip, starts again from the top when looping, or stops.
Sourcepub fn frame(&mut self) -> Option<Frame>
pub fn frame(&mut self) -> Option<Frame>
The frame due now, if it differs from the last one handed out.
Sourcepub fn current_frame(&self) -> Result<Frame>
pub fn current_frame(&self) -> Result<Frame>
The picture at the playhead at the clip’s full size, decoded afresh so playback is not disturbed.