Skip to main content

VideoPlayer

Trait VideoPlayer 

Source
pub trait VideoPlayer: Send {
    // Required methods
    fn poll(&mut self) -> Result<VideoStatus, String>;
    fn frame(&mut self) -> Option<VideoFrame>;
    fn play(&mut self) -> Result<(), String>;
    fn pause(&mut self) -> Result<(), String>;
    fn seek(&mut self, to: Duration) -> Result<(), String>;
    fn set_volume(&mut self, volume: f32);

    // Provided methods
    fn set_looping(&mut self, on: bool) -> bool { ... }
    fn loops(&self) -> u64 { ... }
}
Expand description

A video being played. A failure’s text is shown in place of the picture (the viewer’s error page, for the viewer’s video).

Required Methods§

Source

fn poll(&mut self) -> Result<VideoStatus, String>

Takes what happened since the last call; an error ends the player.

Source

fn frame(&mut self) -> Option<VideoFrame>

The last frame not taken yet, the older ones forgotten.

Source

fn play(&mut self) -> Result<(), String>

Source

fn pause(&mut self) -> Result<(), String>

Source

fn seek(&mut self, to: Duration) -> Result<(), String>

Source

fn set_volume(&mut self, volume: f32)

From 0 to 1.

Provided Methods§

Source

fn set_looping(&mut self, on: bool) -> bool

Loops by itself from now on (or no longer), when it can: whether it does. By default it cannot, and the widget seeks back to the start when it ends.

Source

fn loops(&self) -> u64

How many times it went back to the start by itself.

Implementors§