Enum mediasoup::producer::Producer[][src]

#[non_exhaustive]pub enum Producer {
    Regular(RegularProducer),
    Direct(DirectProducer),
}

A producer represents an audio or video source being injected into a mediasoup router. It’s created on top of a transport that defines how the media packets are carried.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Producer created on transport other than DirectTransport.

Producer created on DirectTransport.

Implementations

impl Producer[src]

pub fn id(&self) -> ProducerId[src]

Producer identifier.

pub fn kind(&self) -> MediaKind[src]

Media kind.

pub fn rtp_parameters(&self) -> &RtpParameters[src]

Producer RTP parameters.

Notes on usage

Check the RTP Parameters and Capabilities section for more details (TypeScript-oriented, but concepts apply here as well).

pub fn type(&self) -> ProducerType[src]

Producer type.

pub fn paused(&self) -> bool[src]

Whether the Producer is paused.

pub fn score(&self) -> Vec<ProducerScore>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

The score of each RTP stream being received, representing their transmission quality.

pub fn app_data(&self) -> &AppData[src]

Custom application data.

pub fn closed(&self) -> bool[src]

Whether the producer is closed.

pub async fn get_stats(&self) -> Result<Vec<ProducerStat>, RequestError>[src]

Returns current RTC statistics of the producer.

Check the RTC Statistics section for more details (TypeScript-oriented, but concepts apply here as well).

pub async fn pause(&self) -> Result<(), RequestError>[src]

Pauses the producer (no RTP is sent to its associated consumers). Calls Consumer::on_producer_pause callback on all its associated consumers.

pub async fn resume(&self) -> Result<(), RequestError>[src]

Resumes the producer (no RTP is sent to its associated consumers). Calls Consumer::on_producer_resume callback on all its associated consumers.

pub async fn enable_trace_event(
    &self,
    types: Vec<ProducerTraceEventType>
) -> Result<(), RequestError>
[src]

Instructs the procuer to emit “trace” events. For monitoring purposes. Use with caution.

pub fn on_score<F: Fn(&Vec<ProducerScore>) + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the producer score changes.

pub fn on_video_orientation_change<F: Fn(ProducerVideoOrientation) + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the video orientation changes. This is just possible if the urn:3gpp:video-orientation RTP extension has been negotiated in the producer RTP parameters.

pub fn on_pause<F: Fn() + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the producer is paused.

pub fn on_resume<F: Fn() + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the producer is resumed.

pub fn on_trace<F: Fn(&ProducerTraceEventData) + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

pub fn on_transport_close<F: FnOnce() + Send + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the transport this producer belongs to is closed for whatever reason. The producer itself is also closed. A on_producer_close callback is called on all its associated consumers.

pub fn on_close<F: FnOnce() + Send + 'static>(&self, callback: F) -> HandlerId[src]

Callback is called when the producer is closed for whatever reason.

NOTE: Callback will be called in place if producer is already closed.

pub fn downgrade(&self) -> WeakProducer[src]

Downgrade Producer to WeakProducer instance.

Trait Implementations

impl Clone for Producer[src]

impl Debug for Producer[src]

impl From<DirectProducer> for Producer[src]

impl From<RegularProducer> for Producer[src]

Auto Trait Implementations

impl !RefUnwindSafe for Producer

impl Send for Producer

impl Sync for Producer

impl Unpin for Producer

impl !UnwindSafe for Producer

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.