Hierarchy

Constructors

Properties

#candidates: RTCIceCandidateInit[] = []
#channelQueue: {
    dataChannelDict?: RTCDataChannelInit;
    label: string;
}[] = []

Type declaration

  • Optional dataChannelDict?: RTCDataChannelInit
  • label: string
#dataChannels: Record<string, RTCDataChannel> = {}
#ignoringOffer: boolean = false
#isSettingRemoteAnswerPending: boolean = false
#makingOffer: boolean = false
#negotiated: boolean = false
#options: {
    rtc: undefined | RTCConfiguration;
    timeout: number;
}

Type declaration

  • rtc: undefined | RTCConfiguration
  • timeout: number
#pc: RTCPeerConnection
#polite: boolean = false
#sc: RTCDataChannel
#streamQueue: {
    name: string;
    stream: MediaStream;
}[] = []

Type declaration

  • name: string
  • stream: MediaStream
#streams: Record<string, {
    name?: string;
    stream?: MediaStream;
}> = {}

Type declaration

  • Optional name?: string
  • Optional stream?: MediaStream
#timeout?: Timeout
prefixed: string | boolean

Accessors

  • get canSignal(): boolean
  • Whether the signaling channel's readyState is open

    Returns boolean

  • get isOpen(): boolean
  • Whether the RTCPeerConnection's signalingState is not closed

    Returns boolean

  • get isPolite(): boolean
  • Whether the peer is polite

    If the peer is polite it will concede when a signal collision occurs

    Returns boolean

  • get stable(): boolean
  • Whether the RTCPeerConnection's signalingState is stable

    Returns boolean

  • get streamNames(): (undefined | string)[]
  • An array of incoming MediaStream names

    Returns (undefined | string)[]

  • get streams(): {
        name?: string;
        stream?: MediaStream;
    }[]
  • An array of incoming MediaStreams

    Returns {
        name?: string;
        stream?: MediaStream;
    }[]

Methods

  • Parameters

    • name: string
    • stream: MediaStream

    Returns void

  • Parameters

    • label: string
    • Optional dataChannelDict: RTCDataChannelInit

    Returns void

  • Type Parameters

    Parameters

    • event: T
    • fn: ((...args) => void)
    • Optional context: any

    Returns this

  • Add a MediaStream to the RTCPeerConnection for streaming audio and video.

    Parameters

    • name: string
    • stream: MediaStream

    Returns void

  • Close the RTCPeerConnection

    Returns void

  • Parameters

    • polite: boolean = false

    Returns void

  • Creates a new data channel with the given label for streaming data across the WebRTC Connection.

    MDN Reference

    Parameters

    • label: string
    • Optional dataChannelDict: RTCDataChannelInit

    Returns void

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (keyof PeerEvents)[]

  • Retrieve the RTCDataChannel with the given label.

    Parameters

    • label: string

      The label of the data channel to retrieve

    Returns RTCDataChannel

    The RTCDataChannel with the given label

  • Parameters

    • newStream: MediaStream
    • local: boolean = false

    Returns void

  • Parameters

    • state: RTCDataChannelState

    Returns void

  • Parameters

    • state: RTCPeerConnectionState

    Returns void

  • Parameters

    • channel: RTCDataChannel

    Returns undefined | boolean

  • Parameters

    • state: RTCIceConnectionState

    Returns void

  • Returns Promise<void>

  • Parameters

    • stream: MediaStream
    • local: boolean = false

    Returns void

  • Processes the signals received from the signaling server.

    Parameters

    Returns Promise<void>

  • Parameters

    • state: RTCSignalingState

    Returns void

  • Return the number of listeners listening to a given event.

    Parameters

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Type Parameters

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    Parameters

    • event: T
    • fn: ((...args) => void)
    • Optional context: any

    Returns this

  • Add a one-time listener for a given event.

    Type Parameters

    Parameters

    • event: T
    • fn: ((...args) => void)
    • Optional context: any

    Returns this

  • Open the RTCPeerConnection and begin negotiation.

    Returns void

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: keyof PeerEvents

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
    • Optional context: any
    • Optional once: boolean

    Returns this

  • Remove a MediaStream from the RTCPeerConnection.

    This will stop local and remote playback.

    Parameters

    • stream: MediaStream

    Returns void

Generated using TypeDoc