pub struct Track { /* private fields */ }
Expand description

Wrapper around a platform::MediaStreamTrack received from a getUserMedia()/getDisplayMedia() request.

Underlying platform::MediaStreamTrack is stopped on this Track’s Drop.

Implementations§

source§

impl Track

source

pub const fn new(track: MediaStreamTrack, source_kind: MediaSourceKind) -> Self

Builds a new Track from the provided platform::MediaStreamTrack and proto::MediaSourceKind.

source

pub const fn platform_track(&self) -> &MediaStreamTrack

Returns the underlying platform::MediaStreamTrack of this Track.

source

pub fn set_enabled(&self, enabled: bool)

Changes enabled attribute on the underlying MediaStreamTrack.

source

pub fn id(&self) -> String

Returns id of underlying MediaStreamTrack.

source

pub const fn media_source_kind(&self) -> MediaSourceKind

Returns this Track’s media source kind.

source

pub fn kind(&self) -> MediaKind

Returns this Track’s kind (audio/video).

source

pub fn on_ended(&self, callback: Function<()>)

Sets a callback to invoke when this Track is ended.

source

pub async fn state(&self) -> MediaStreamTrackState

Returns a MediaStreamTrackState::Live if this Track is active, or a MediaStreamTrackState::Ended if it has ended.

source

pub async fn fork(self: &Rc<Self>) -> Self

Forks this Track.

Creates a new Track from this Track’s platform::MediaStreamTrack using a clone() method.

Forked Track will hold a strong reference to this Track.

source

pub async fn stop(&self)

Stops this Track.

Trait Implementations§

source§

impl AsRef<MediaStreamTrack> for Track

source§

fn as_ref(&self) -> &MediaStreamTrack

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Debug for Track

source§

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

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

impl Drop for Track

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Track

§

impl !Send for Track

§

impl !Sync for Track

§

impl Unpin for Track

§

impl UnwindSafe for Track

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<E> WrapTraced<E> for E

source§

fn wrap_traced(self, f: Frame) -> Traced<E>

Wraps this error into a Traced wrapper, storing the given Frame of a Trace inside.
source§

impl<T> DartSafe for Twhere T: UnwindSafe + RefUnwindSafe,