pub trait TrackLocal {
    // Required methods
    fn bind<'life0, 'life1, 'async_trait>(
        &'life0 self,
        t: &'life1 TrackLocalContext
    ) -> Pin<Box<dyn Future<Output = Result<RTCRtpCodecParameters>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unbind<'life0, 'life1, 'async_trait>(
        &'life0 self,
        t: &'life1 TrackLocalContext
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: '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 implementations, or use the implementations in pkg/media

Required Methods§

source

fn bind<'life0, 'life1, 'async_trait>( &'life0 self, t: &'life1 TrackLocalContext ) -> Pin<Box<dyn Future<Output = Result<RTCRtpCodecParameters>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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

source

fn unbind<'life0, 'life1, 'async_trait>( &'life0 self, t: &'life1 TrackLocalContext ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

unbind should implement the teardown logic when the track is no longer needed. This happens because a track has been stopped.

source

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’

source

fn stream_id(&self) -> &str

stream_id is the group this track belongs too. This must be unique

source

fn kind(&self) -> RTPCodecType

kind controls if this TrackLocal is audio or video

source

fn as_any(&self) -> &dyn Any

Implementors§