Struct medea_jason::peer::MediaConnections[][src]

pub struct MediaConnections(_);

Implementations

impl MediaConnections[src]

pub fn new(
    peer: Rc<RtcPeerConnection>,
    peer_events_sender: UnboundedSender<PeerEvent>
) -> Self
[src]

Instantiates new MediaConnections storage for a given RtcPeerConnection.

pub fn get_transceivers_sides(
    &self,
    kind: MediaKind,
    direction: TrackDirection,
    source_kind: Option<MediaSourceKind>
) -> Vec<Rc<dyn TransceiverSide>>
[src]

Returns all Senders and Receivers from this MediaConnections with provided MediaKind, TrackDirection and MediaSourceKind.

#[must_use]pub fn is_all_tracks_in_media_state(
    &self,
    kind: MediaKind,
    direction: TrackDirection,
    source_kind: Option<MediaSourceKind>,
    state: MediaState
) -> bool
[src]

Indicates whether all TransceiverSides with provided MediaKind, TrackDirection and MediaSourceKind is in the provided MediaExchangeState.

pub fn get_mids(
    &self
) -> Result<HashMap<TrackId, String>, Traced<MediaConnectionsError>>
[src]

Returns mapping from a proto::Track ID to a mid of this track’s RtcRtpTransceiver.

Errors

Errors with MediaConnectionsError::SendersWithoutMid if some Sender doesn’t have mid.

Errors with MediaConnectionsError::ReceiversWithoutMid if some Receiver doesn’t have mid.

pub fn get_transceivers_statuses(&self) -> HashMap<TrackId, bool>[src]

Returns activity statuses of the all Senders and Receivers from this MediaConnections.

pub fn get_transceiver_side_by_id(
    &self,
    track_id: TrackId
) -> Option<Rc<dyn TransceiverSide>>
[src]

Returns Rc to TransceiverSide with a provided TrackId.

Returns None if TransceiverSide with a provided TrackId doesn’t exists in this MediaConnections.

pub fn insert_sender(&self, sender: Component)[src]

pub fn insert_receiver(&self, receiver: Component)[src]

pub fn get_tracks_request(
    &self,
    kinds: LocalStreamUpdateCriteria
) -> Option<TracksRequest>
[src]

Returns TracksRequest based on Senders in this MediaConnections. Senders are chosen based on provided LocalStreamUpdateCriteria.

pub async fn insert_local_tracks(
    &self,
    tracks: &HashMap<TrackId, Rc<Track>>
) -> Result<HashMap<TrackId, Stable>, Traced<MediaConnectionsError>>
[src]

Inserts provided tracks into Senders based on track IDs.

local::Tracks are inserted into Sender’s RtcRtpTransceivers via replaceTrack method, changing its direction to sendonly.

Returns HashMap with media_exchange_state::Stables updates for the Senders.

Errors

With MediaConnectionsError::InvalidMediaTracks if provided HashMap doesn’t contain required local::Track.

With MediaConnectionsError::InvalidMediaTrack if some local::Track cannot be inserted into associated Sender because of constraints mismatch.

With MediaConnectionsError::CouldNotInsertLocalTrack if some local::Track cannot be inserted into provided Senders transceiver.

pub fn add_remote_track(
    &self,
    track_event: &RtcTrackEvent
) -> Result<(), Traced<MediaConnectionsError>>
[src]

Handles RtcTrackEvent by adding new track to the corresponding Receiver.

Returns ID of associated Sender and provided track TrackId, if any.

Errors

Errors with MediaConnectionsError::CouldNotInsertRemoteTrack if could not find Receiver by transceivers mid.

Panics

If Transceiver from the provided RtcTrackEvent doesn’t have a mid. Not supposed to happen, since RtcTrackEvent is only fired when a Transceiver is negotiated, thus have a mid.

pub fn sync_receivers(&self)[src]

Iterates over all Receivers with mid and without Transceiver, trying to find the corresponding Transceiver in RtcPeerConnection and to insert it into the Receiver.

pub fn get_senders_without_tracks_ids(
    &self,
    kinds: LocalStreamUpdateCriteria
) -> Vec<TrackId>
[src]

Returns all Senders which are matches provided LocalStreamUpdateCriteria and doesn’t have local::Track.

pub async fn drop_send_tracks(&self, kinds: LocalStreamUpdateCriteria)[src]

Drops local::Tracks of all Senders which are matches provided LocalStreamUpdateCriteria.

pub fn remove_track(&self, track_id: TrackId)[src]

Removes a sender::Component or a receiver::Component with the provided TrackId from these MediaConnections.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<E> WrapTraced<E> for E[src]