Skip to main content

JsEvent

Enum JsEvent 

Source
pub enum JsEvent<P = Payload> {
Show 23 variants IceCandidate { candidate: String, sdp_mid: Option<String>, sdp_m_line_index: Option<u16>, username_fragment: Option<String>, url: Option<String>, }, IceCandidateError { address: Option<String>, port: Option<u16>, url: String, error_code: u16, error_text: String, }, SignalingState { state: String, }, IceGatheringState { state: String, }, IceConnectionState { state: String, }, ConnectionState { state: String, }, NegotiationNeeded, SctpState { state: &'static str, }, DtlsState { state: String, }, DataChannelOpen { channel: u32, id: Option<u16>, label: String, protocol: String, ordered: bool, max_packet_life_time: Option<u16>, max_retransmits: Option<u16>, negotiated: bool, priority: u16, }, DataChannelClosing { channel: u32, }, DataChannelClose { channel: u32, }, DataChannelError { channel: u32, error_detail: String, message: String, sctp_cause_code: Option<u16>, label: Option<String>, id: Option<u16>, }, DataChannelSent { channel: u32, bytes: f64, }, DataChannelMessage { channel: u32, text: bool, data: P, }, TrackUnmute { transceiver: u32, generation: u32, }, Rtp { transceiver: u32, data: P, }, KeyFrameRequest { transceiver: u32, }, EncodedFrame { transceiver: u32, data: P, key_frame: bool, width: Option<u16>, height: Option<u16>, info: ReceivedFrameInfo, }, TrackMute { transceiver: u32, }, TrackResize { transceiver: u32, width: u32, height: u32, }, MediaFrame { transceiver: u32, data: P, key_frame: bool, mime_type: String, rtp_timestamp: u32, width: Option<u32>, height: Option<u32>, }, OpDone { op: u32, error: Option<Error>, },
}
Expand description

An event for JavaScript, delivered in batches by Peer::next_events. Data channels are named by their engine handle (channel), which exists before the SCTP stream id does.

P is how a received payload is held: Payload from the engine; a front end that hands buffers to its JavaScript without a copy swaps it for its own buffer type with JsEvent::map_payload.

Variants§

§

IceCandidate

Fields

§candidate: String
§sdp_mid: Option<String>
§sdp_m_line_index: Option<u16>
§username_fragment: Option<String>
§

IceCandidateError

Fields

§address: Option<String>
§port: Option<u16>
§error_code: u16
§error_text: String
§

SignalingState

Fields

§state: String
§

IceGatheringState

Fields

§state: String
§

IceConnectionState

Fields

§state: String
§

ConnectionState

Fields

§state: String
§

NegotiationNeeded

§

SctpState

RTCSctpTransport.state, from the SCTP association.

Fields

§state: &'static str
§

DtlsState

The DTLS transport’s own state, as the engine has it (the peer’s close_notify closes it while the connection stays connected).

Fields

§state: String
§

DataChannelOpen

Fields

§channel: u32
§label: String
§protocol: String
§ordered: bool
§max_packet_life_time: Option<u16>
§max_retransmits: Option<u16>
§negotiated: bool
§priority: u16

The DCEP priority (RFC 8832 5.1): the peer’s, for a channel it opened.

§

DataChannelClosing

Fields

§channel: u32
§

DataChannelClose

Fields

§channel: u32
§

DataChannelError

A data channel failed (W3C: an error event with an RTCError, then the channel closes): the engine’s RTCError for it (RTCPeerConnection::data_channel_error), and what names the channel.

Fields

§channel: u32
§error_detail: String
§message: String
§sctp_cause_code: Option<u16>
§

DataChannelSent

SCTP took bytes more of the channel’s application data from its send queue (W3C: “when the underlying data transport sends data from its queue … reduce [[BufferedAmount]]”).

Fields

§channel: u32
§bytes: f64
§

DataChannelMessage

Fields

§channel: u32
§text: bool
§data: P
§

TrackUnmute

A receiver’s first RTP packet since JavaScript last muted its track: the track unmutes, unless JavaScript muted it again (or started receiving again) since, which generation tells.

Fields

§transceiver: u32
§generation: u32
§

Rtp

An RTP packet for a Deno.webrtc.readRtp() reader (header included).

Fields

§transceiver: u32
§data: P
§

KeyFrameRequest

The remote receiver asked a sender for a key frame (PLI / FIR).

Fields

§transceiver: u32
§

EncodedFrame

A received frame, for the receiver’s encoded transform.

Fields

§transceiver: u32
§data: P
§key_frame: bool
§width: Option<u16>
§height: Option<u16>
§

TrackMute

A receiver’s RTP stopped for media_sink::SILENCE: its track mutes.

Fields

§transceiver: u32
§

TrackResize

A receiver’s video names a new coded size (getSettings()).

Fields

§transceiver: u32
§width: u32
§height: u32
§

MediaFrame

A received frame, for Deno.webrtc.readFrames() readers.

Fields

§transceiver: u32
§data: P
§key_frame: bool
§mime_type: String
§rtp_timestamp: u32
§width: Option<u32>
§height: Option<u32>
§

OpDone

A two-phase operation finished (Peer::set_remote_description, Peer::add_ice_candidate): op is the id the call returned, and error (left out on success) its failure as {"kind": "NotCapable", "message": "..."}, kind being an ErrorKind::name.

Fields

§op: u32
§error: Option<Error>

Implementations§

Source§

impl<P> JsEvent<P>

Source

pub fn map_payload<Q>(self, f: impl FnOnce(P) -> Q) -> JsEvent<Q>

The same event with its payload (if any) converted by f.

Trait Implementations§

Source§

impl<P: Debug> Debug for JsEvent<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Serialize for JsEvent<P>
where P: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<P> Forget for JsEvent<P>

§

impl<P> Freeze for JsEvent<P>
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, &'static str: Freeze, P: Freeze, PhantomData<u32>: Freeze,

§

impl<P> Move for JsEvent<P>

§

impl<P> RefUnwindSafe for JsEvent<P>
where P: RefUnwindSafe,

§

impl<P> Send for JsEvent<P>
where P: Send, RawVecInner: Send, &'static str: Send,

§

impl<P> Sync for JsEvent<P>
where P: Sync, RawVecInner: Sync,

§

impl<P> Unpin for JsEvent<P>
where P: Unpin, *const u8 is !null: Unpin, &'static str: Unpin,

§

impl<P> UnsafeUnpin for JsEvent<P>

§

impl<P> UnwindSafe for JsEvent<P>
where RawVecInner: UnwindSafe, &'static str: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.