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
.