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
impl Track
sourcepub const fn new(track: MediaStreamTrack, source_kind: MediaSourceKind) -> Self
pub const fn new(track: MediaStreamTrack, source_kind: MediaSourceKind) -> Self
Builds a new Track
from the provided platform::MediaStreamTrack
and proto::MediaSourceKind
.
sourcepub const fn platform_track(&self) -> &MediaStreamTrack
pub const fn platform_track(&self) -> &MediaStreamTrack
Returns the underlying platform::MediaStreamTrack
of this Track
.
sourcepub fn set_enabled(&self, enabled: bool)
pub fn set_enabled(&self, enabled: bool)
Changes enabled
attribute on the underlying
MediaStreamTrack.
sourcepub fn id(&self) -> String
pub fn id(&self) -> String
Returns id
of underlying MediaStreamTrack.
sourcepub const fn media_source_kind(&self) -> MediaSourceKind
pub const fn media_source_kind(&self) -> MediaSourceKind
Returns this Track
’s media source kind.
sourcepub fn on_ended(&self, callback: Function<()>)
pub fn on_ended(&self, callback: Function<()>)
Sets a callback to invoke when this Track
is ended.
sourcepub async fn state(&self) -> MediaStreamTrackState
pub async fn state(&self) -> MediaStreamTrackState
Returns a MediaStreamTrackState::Live
if this Track
is active,
or a MediaStreamTrackState::Ended
if it has ended.
Trait Implementations§
source§impl AsRef<MediaStreamTrack> for Track
impl AsRef<MediaStreamTrack> for Track
source§fn as_ref(&self) -> &MediaStreamTrack
fn as_ref(&self) -> &MediaStreamTrack
Converts this type into a shared reference of the (usually inferred) input type.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more