pub struct Receiver { /* private fields */ }Expand description
Representation of a remote::Track that is being received from some
remote peer. It may have two states: waiting and receiving.
We can save related platform::Transceiver and the actual
remote::Track only when remote::Track data arrives.
Implementations§
Source§impl Receiver
impl Receiver
Sourcepub async fn new(
state: &State,
media_connections: &MediaConnections,
track_events_sender: UnboundedSender<TrackEvent>,
recv_constraints: &RecvConstraints,
connection_mode: ConnectionMode,
) -> Self
pub async fn new( state: &State, media_connections: &MediaConnections, track_events_sender: UnboundedSender<TrackEvent>, recv_constraints: &RecvConstraints, connection_mode: ConnectionMode, ) -> Self
Creates a new platform::Transceiver if provided mid is None,
otherwise creates a Receiver without a platform::Transceiver. It
will be injected when a remote::Track will arrive.
Created platform::Transceiver direction is set to
TransceiverDirection::INACTIVE if enabled_individual is
false.
track field in the created Receiver will be None, since
Receiver must be created before the actual remote::Track data
arrives.
Sourcepub const fn caps(&self) -> &TrackConstraints
pub const fn caps(&self) -> &TrackConstraints
Returns TrackConstraints of this Receiver.
Sourcepub async fn is_receiving(&self) -> bool
pub async fn is_receiving(&self) -> bool
Indicates whether this Receiver receives media data.
Sourcepub fn send_media_exchange_state_intention(&self, state: Transition)
pub fn send_media_exchange_state_intention(&self, state: Transition)
Sends TrackEvent::MediaExchangeIntention with the provided
media_exchange_state.
Sourcepub async fn set_remote_track(
&self,
transceiver: Transceiver,
new_track: MediaStreamTrack,
)
pub async fn set_remote_track( &self, transceiver: Transceiver, new_track: MediaStreamTrack, )
Adds the provided platform::MediaStreamTrack and
platform::Transceiver to this Receiver.
Sets platform::MediaStreamTrack::enabled same as
enabled_individual of this Receiver.
Sourcepub fn set_media_direction(&self, direction: MediaDirection)
pub fn set_media_direction(&self, direction: MediaDirection)
Updates MediaDirection of this Receiver.
Sourcepub fn set_transceiver(&self, transceiver: Transceiver)
pub fn set_transceiver(&self, transceiver: Transceiver)
Replaces Receiver’s platform::Transceiver with the provided
platform::Transceiver.
Doesn’t update platform::TransceiverDirection of the
platform::Transceiver.
No-op if provided with the same platform::Transceiver as already
exists in this Receiver.
Sourcepub fn transceiver(&self) -> Option<Transceiver>
pub fn transceiver(&self) -> Option<Transceiver>
Returns a platform::Transceiver of this Receiver.
Returns None if this Receiver doesn’t have a
platform::Transceiver.