Skip to main content

VideoTrack

Struct VideoTrack 

Source
pub struct VideoTrack { /* private fields */ }
Expand description

Seekable cross-platform video playback track with poster frame, timed frames, volume, speed, and captions.

Implementations§

Source§

impl VideoTrack

Transport playback, seeking, captions, and sample builder for VideoTrack.

Source

pub fn sample_hdr_video() -> Self

Generates a deterministic 12-second sample video track with poster, timed frames, and closed captions.

§Returns
  • Self - Ready VideoTrack.
Source

pub fn toggle_play(&mut self)

Toggles between PlaybackState::Playing and PlaybackState::Paused.

§Arguments
  • &Self - Mutable video track.
Source

pub fn seek(&mut self, secs: f32)

Seeks playback position to secs, clamped to [0.0, duration_secs].

§Arguments
  • &Self - Mutable video track.
  • f32 - Target timestamp in seconds.
Source

pub fn step(&mut self, dt_secs: f32)

Advances video playback by dt_secs * playback_rate.

§Arguments
  • &Self - Mutable video track.
  • f32 - Elapsed wall delta time in seconds.
Source

pub fn from_mp4_bytes(bytes: Vec<u8>, title: &str) -> Result<Self, String>

Decodes a real ISOBMFF MP4 container through Mp4Demuxer and SoftwareVideoDecoder into a VideoTrack.

§Arguments
  • Vec<u8> - Complete MP4 container bytes.
  • &str - Human-readable track title.
§Returns
  • Result<Self, String> - Decoded VideoTrack with PTS-ordered frames or descriptive error.
Source

pub fn active_frame_ref(&self) -> &ImageBuffer

Returns a zero-copy borrowed reference to the video ImageBuffer corresponding to current_time_secs.

§Arguments
  • &Self - Video track reference.
§Returns
  • &ImageBuffer - Borrowed active video frame or poster image.
Source

pub fn active_frame(&self) -> ImageBuffer

Returns the video ImageBuffer corresponding to current_time_secs.

§Arguments
  • &Self - Video track reference.
§Returns
  • ImageBuffer - Active video frame or poster image.
Source

pub fn active_caption(&self) -> String

Returns the synchronized closed-caption line for the active playback timestamp.

§Arguments
  • &Self - Video track reference.
§Returns
  • String - Active closed-caption string or empty string.
Source§

impl VideoTrack

Source

pub fn get_metadata(&self) -> &MediaMetadata

Source

pub fn get_mut_metadata(&mut self) -> &mut MediaMetadata

Source

pub fn set_metadata(&mut self, val: MediaMetadata) -> &mut Self

Source

pub fn get_codec(&self) -> VideoCodec

Source

pub fn get_mut_codec(&mut self) -> &mut VideoCodec

Source

pub fn set_codec(&mut self, val: VideoCodec) -> &mut Self

Source

pub fn get_poster(&self) -> &ImageBuffer

Source

pub fn get_mut_poster(&mut self) -> &mut ImageBuffer

Source

pub fn set_poster(&mut self, val: ImageBuffer) -> &mut Self

Source

pub fn get_frames(&self) -> &Vec<MediaFrame>

Source

pub fn get_mut_frames(&mut self) -> &mut Vec<MediaFrame>

Source

pub fn set_frames(&mut self, val: Vec<MediaFrame>) -> &mut Self

Source

pub fn get_state(&self) -> PlaybackState

Source

pub fn get_mut_state(&mut self) -> &mut PlaybackState

Source

pub fn set_state(&mut self, val: PlaybackState) -> &mut Self

Source

pub fn get_current_time_secs(&self) -> f32

Source

pub fn get_mut_current_time_secs(&mut self) -> &mut f32

Source

pub fn set_current_time_secs(&mut self, val: f32) -> &mut Self

Source

pub fn get_volume(&self) -> f32

Source

pub fn get_mut_volume(&mut self) -> &mut f32

Source

pub fn set_volume(&mut self, val: f32) -> &mut Self

Source

pub fn get_muted(&self) -> bool

Source

pub fn get_mut_muted(&mut self) -> &mut bool

Source

pub fn set_muted(&mut self, val: bool) -> &mut Self

Source

pub fn get_playback_rate(&self) -> f32

Source

pub fn get_mut_playback_rate(&mut self) -> &mut f32

Source

pub fn set_playback_rate(&mut self, val: f32) -> &mut Self

Source

pub fn get_looping(&self) -> bool

Source

pub fn get_mut_looping(&mut self) -> &mut bool

Source

pub fn set_looping(&mut self, val: bool) -> &mut Self

Source

pub fn get_captions(&self) -> &Vec<String>

Source

pub fn get_mut_captions(&mut self) -> &mut Vec<String>

Source

pub fn set_captions(&mut self, val: Vec<String>) -> &mut Self

Trait Implementations§

Source§

impl Clone for VideoTrack

Source§

fn clone(&self) -> Self

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 VideoTrack

Source§

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

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

impl Default for VideoTrack

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for VideoTrack

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for VideoTrack

Auto Trait Implementations§

§

impl Forget for VideoTrack

§

impl Freeze for VideoTrack
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const ArcInner<[u8]> is !null: Freeze, PhantomData<ArcInner<[u8]>>: Freeze, PhantomData<MediaFrame>: Freeze, PhantomData<String>: Freeze,

§

impl Move for VideoTrack

§

impl RefUnwindSafe for VideoTrack

§

impl Send for VideoTrack
where RawVecInner: Send, Arc<[u8]>: Send,

§

impl Sync for VideoTrack
where RawVecInner: Sync, Arc<[u8]>: Sync,

§

impl Unpin for VideoTrack
where *const u8 is !null: Unpin, Arc<[u8]>: Unpin,

§

impl UnsafeUnpin for VideoTrack

§

impl UnwindSafe for VideoTrack
where RawVecInner: UnwindSafe, Arc<[u8]>: UnwindSafe,

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.