Trait webrtc::track::track_local::TrackLocal
source · pub trait TrackLocal {
fn bind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<RTCRtpCodecParameters>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn unbind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn id(&self) -> &str;
fn stream_id(&self) -> &str;
fn kind(&self) -> RTPCodecType;
fn as_any(&self) -> &dyn Any;
}
Expand description
TrackLocal is an interface that controls how the user can send media The user can provide their own TrackLocal implementatiosn, or use the implementations in pkg/media
Required Methods
sourcefn bind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<RTCRtpCodecParameters>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn bind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<RTCRtpCodecParameters>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
bind should implement the way how the media data flows from the Track to the PeerConnection This will be called internally after signaling is complete and the list of available codecs has been determined
sourcefn unbind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn unbind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
unbind should implement the teardown logic when the track is no longer needed. This happens because a track has been stopped.
sourcefn id(&self) -> &str
fn id(&self) -> &str
id is the unique identifier for this Track. This should be unique for the stream, but doesn’t have to globally unique. A common example would be ‘audio’ or ‘video’ and stream_id would be ‘desktop’ or ‘webcam’
sourcefn kind(&self) -> RTPCodecType
fn kind(&self) -> RTPCodecType
kind controls if this TrackLocal is audio or video