[][src]Struct mediasoup::webrtc_transport::WebRtcTransport

pub struct WebRtcTransport { /* fields omitted */ }

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]

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]

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]

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]

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]

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]

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]

impl Transport for WebRtcTransport[src]

impl TransportGeneric for WebRtcTransport[src]

type Dump = WebRtcTransportDump

type Stat = WebRtcTransportStat

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,