FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    MediaPlayer

    struct · ferroui-media-video · v0.5.0

    struct MediaPlayer
    

    Caller-owned playback can feed multiple views/texture consumers. Cloning a player never opens another decoder. Futures hold weak player ownership.

    View source

    Members

    new

    fn new(provider: Rc<dyn MediaPlayerProvider>) -> Self
    

    Source

    same_player

    fn same_player(self: &Self, other: &Self) -> bool
    

    Source

    downgrade

    fn downgrade(self: &Self) -> WeakMediaPlayer
    

    Source

    events

    fn events(self: &Self) -> &MediaEvent<MediaPlayerEvent>
    

    Source

    playback_session

    fn playback_session(self: &Self) -> MediaPlaybackSession
    

    Source

    options

    fn options(self: &Self) -> MediaPlayerOptions
    

    Source

    frames

    fn frames(self: &Self) -> Arc<FrameMailbox>
    

    Source

    has_pending_frame_work

    fn has_pending_frame_work(self: &Self) -> bool
    

    Source

    requested_state

    fn requested_state(self: &Self) -> PlaybackIntent
    

    Source

    supports_playback_rate

    fn supports_playback_rate(self: &Self) -> bool
    

    Source

    playback_rate

    fn playback_rate(self: &Self) -> f64
    

    Source

    supports_casting

    fn supports_casting(self: &Self) -> bool
    

    Source

    cast

    fn cast(self: &Self) -> MediaFuture<()>
    

    Source

    tracks

    fn tracks(self: &Self, kind: MediaTrackKind) -> Vec<MediaTrack>
    

    Source

    select_track

    fn select_track(self: &Self, kind: MediaTrackKind, id: Option<u32>) -> Result<(), MediaError>
    

    Source

    caption_text

    fn caption_text(self: &Self) -> Option<String>
    

    Source

    set_playback_rate

    fn set_playback_rate(self: &Self, rate: f64) -> Result<(), MediaError>
    

    Source

    set_options

    fn set_options(self: &Self, options: MediaPlayerOptions) -> Result<(), MediaError>
    

    Source

    set_source

    fn set_source(self: &Self, source: MediaSource) -> MediaFuture<()>
    

    Replacement invalidates callbacks/frames immediately, even if the future is never polled. Dropping pending creation retires its provisional owner.

    Source

    rebind_provider

    fn rebind_provider(self: &Self, provider: Rc<dyn MediaPlayerProvider>) -> MediaFuture<()>
    

    Replaces the renderer-bound provider without changing source ownership, audio options or requested transport state. Old callbacks and frames are invalidated immediately. The newest queued seek takes precedence over the last achieved position. Budgets belong to providers and must be shared across device generations, including retired allocations.

    Source

    source

    fn source(self: &Self) -> Option<MediaSource>
    

    Source

    suspend_for_device_loss

    fn suspend_for_device_loss(self: &Self)
    

    Stop using a lost device immediately. Source and current intent remain selected for rebind_provider; commands issued while suspended update that intent and the latest queued seek. This does not claim completion of outstanding native GPU work.

    Source

    play

    fn play(self: &Self) -> MediaFuture<()>
    

    Source

    pause

    fn pause(self: &Self) -> Result<(), MediaError>
    

    Source

    seek

    fn seek(self: &Self, position: Duration) -> MediaFuture<Duration>
    

    Source

    stop

    fn stop(self: &Self) -> MediaFuture<Duration>
    

    Source

    clear_source

    fn clear_source(self: &Self)
    

    Source

    poll

    fn poll(self: &Self) -> Result<Option<MediaFuture<()>>, MediaError>
    

    Called by the framework render/timer lifecycle, never a new global clock. Loop restart is returned as explicit asynchronous work for that lifecycle.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Clone

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.