Struct mediasoup::webrtc_transport::WebRtcTransport [−][src]
A WebRTC transport represents a network path negotiated by both, a WebRTC endpoint and mediasoup, via ICE and DTLS procedures. A WebRTC transport may be used to receive media, to send media or to both receive and send. There is no limitation in mediasoup. However, due to their design, mediasoup-client and libmediasoupclient require separate WebRTC transports for sending and receiving.
Notes on usage
The WebRTC transport implementation of mediasoup is ICE Lite, meaning that it does not initiate ICE connections but expects ICE Binding Requests from endpoints.
Implementations
impl WebRtcTransport
[src]
pub async fn connect(
&self,
remote_parameters: WebRtcTransportRemoteParameters
) -> Result<(), RequestError>
[src]
&self,
remote_parameters: WebRtcTransportRemoteParameters
) -> Result<(), RequestError>
Provide the WebRtcTransport with remote parameters.
Example
use mediasoup::data_structures::{DtlsParameters, DtlsRole, DtlsFingerprint}; use mediasoup::webrtc_transport::WebRtcTransportRemoteParameters; // Calling connect() on a PlainTransport created with comedia and rtcp_mux set. webrtc_transport .connect(WebRtcTransportRemoteParameters { dtls_parameters: DtlsParameters { role: DtlsRole::Server, fingerprints: vec![ DtlsFingerprint::Sha256 { value: [ 0xE5, 0xF5, 0xCA, 0xA7, 0x2D, 0x93, 0xE6, 0x16, 0xAC, 0x21, 0x09, 0x9F, 0x23, 0x51, 0x62, 0x8C, 0xD0, 0x66, 0xE9, 0x0C, 0x22, 0x54, 0x2B, 0x82, 0x0C, 0xDF, 0xE0, 0xC5, 0x2C, 0x7E, 0xCD, 0x53, ], }, ], }, }) .await?;
pub async fn set_max_incoming_bitrate(
&self,
bitrate: u32
) -> Result<(), RequestError>
[src]
&self,
bitrate: u32
) -> Result<(), RequestError>
Set maximum incoming bitrate for media streams sent by the remote endpoint over this transport.
pub fn ice_role(&self) -> IceRole
[src]
Local ICE role. Due to the mediasoup ICE Lite design, this is always Controlled
.
pub fn ice_parameters(&self) -> &IceParameters
[src]
Local ICE parameters.
pub fn ice_candidates(&self) -> &Vec<IceCandidate>ⓘ
[src]
Local ICE candidates.
pub fn ice_state(&self) -> IceState
[src]
Current ICE state.
pub fn ice_selected_tuple(&self) -> Option<TransportTuple>
[src]
The selected transport tuple if ICE is in Connected
or Completed
state. It is None
if
ICE is not established (no working candidate pair was found).
pub fn dtls_parameters(&self) -> DtlsParameters
[src]
Local DTLS parameters.
pub fn dtls_state(&self) -> DtlsState
[src]
Current DTLS state.
pub fn dtls_remote_cert(&self) -> Option<String>
[src]
The remote certificate in PEM format. It is Some
once the DTLS state becomes Connected
.
Notes on usage
The application may want to inspect the remote certificate for authorization purposes by using some certificates utility.
pub fn sctp_parameters(&self) -> Option<SctpParameters>
[src]
Local SCTP parameters. Or None
if SCTP is not enabled.
pub fn sctp_state(&self) -> Option<SctpState>
[src]
Current SCTP state. Or None
if SCTP is not enabled.
pub async fn restart_ice(&self) -> Result<IceParameters, RequestError>
[src]
Restarts the ICE layer by generating new local ICE parameters that must be signaled to the remote endpoint.
pub fn on_ice_state_change<F: Fn(IceState) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when the transport ICE state changes.
pub fn on_ice_selected_tuple_change<F: Fn(&TransportTuple) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called after ICE state becomes Completed
and when the ICE selected tuple
changes.
pub fn on_dtls_state_change<F: Fn(DtlsState) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when the transport DTLS state changes.
pub fn on_sctp_state_change<F: Fn(SctpState) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when the transport SCTP state changes.
pub fn downgrade(&self) -> WeakWebRtcTransport
[src]
Downgrade WebRtcTransport
to WeakWebRtcTransport
instance.
Trait Implementations
impl Clone for WebRtcTransport
[src]
fn clone(&self) -> WebRtcTransport
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for WebRtcTransport
[src]
impl Transport for WebRtcTransport
[src]
fn id(&self) -> TransportId
[src]
fn router_id(&self) -> RouterId
[src]
fn app_data(&self) -> &AppData
[src]
fn closed(&self) -> bool
[src]
fn produce<'life0, 'async_trait>(
&'life0 self,
producer_options: ProducerOptions
) -> Pin<Box<dyn Future<Output = Result<Producer, ProduceError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
producer_options: ProducerOptions
) -> Pin<Box<dyn Future<Output = Result<Producer, ProduceError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn consume<'life0, 'async_trait>(
&'life0 self,
consumer_options: ConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<Consumer, ConsumeError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
consumer_options: ConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<Consumer, ConsumeError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn produce_data<'life0, 'async_trait>(
&'life0 self,
data_producer_options: DataProducerOptions
) -> Pin<Box<dyn Future<Output = Result<DataProducer, ProduceDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data_producer_options: DataProducerOptions
) -> Pin<Box<dyn Future<Output = Result<DataProducer, ProduceDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn consume_data<'life0, 'async_trait>(
&'life0 self,
data_consumer_options: DataConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<DataConsumer, ConsumeDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data_consumer_options: DataConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<DataConsumer, ConsumeDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn enable_trace_event<'life0, 'async_trait>(
&'life0 self,
types: Vec<TransportTraceEventType>
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
types: Vec<TransportTraceEventType>
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn on_new_producer(
&self,
callback: Box<dyn Fn(&Producer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&Producer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_consumer(
&self,
callback: Box<dyn Fn(&Consumer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&Consumer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_data_producer(
&self,
callback: Box<dyn Fn(&DataProducer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&DataProducer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_data_consumer(
&self,
callback: Box<dyn Fn(&DataConsumer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&DataConsumer) + Send + Sync + 'static>
) -> HandlerId
fn on_trace(
&self,
callback: Box<dyn Fn(&TransportTraceEventData) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&TransportTraceEventData) + Send + Sync + 'static>
) -> HandlerId
fn on_router_close(
&self,
callback: Box<dyn FnOnce() + Send + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn FnOnce() + Send + 'static>
) -> HandlerId
fn on_close(&self, callback: Box<dyn FnOnce() + Send + 'static>) -> HandlerId
[src]
impl TransportGeneric for WebRtcTransport
[src]
type Dump = WebRtcTransportDump
type Stat = WebRtcTransportStat
Stats data structure specific to each transport.
fn get_stats<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Stat>, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Stat>, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
#[must_use]fn dump<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Dump, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Dump, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations
impl !RefUnwindSafe for WebRtcTransport
impl Send for WebRtcTransport
impl Sync for WebRtcTransport
impl Unpin for WebRtcTransport
impl !UnwindSafe for WebRtcTransport
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,