Skip to main content

Class: RTCPeerConnection

Hierarchy#

Constructors#

constructor#

new RTCPeerConnection(__namedParameters?)

Parameters#

NameType
__namedParametersPartial<PeerConfig>

Overrides#

EventTarget.constructor

Defined in#

packages/webrtc/src/peerConnection.ts:111

Properties#

certificates#

Private Readonly certificates: RTCCertificate[] = []

Defined in#

packages/webrtc/src/peerConnection.ts:101


cname#

Readonly cname: string

Defined in#

packages/webrtc/src/peerConnection.ts:65


configuration#

configuration: Required<PeerConfig>

Defined in#

packages/webrtc/src/peerConnection.ts:70


connectionState#

connectionState: "closed" | "connecting" | "failed" | "disconnected" | "new" | "connected" = "new"

Defined in#

packages/webrtc/src/peerConnection.ts:72


connectionStateChange#

Readonly connectionStateChange: default<["closed" | "connecting" | "failed" | "disconnected" | "new" | "connected"]>

Defined in#

packages/webrtc/src/peerConnection.ts:81


currentLocalDescription#

Private Optional currentLocalDescription: SessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:106


currentRemoteDescription#

Private Optional currentRemoteDescription: SessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:107


dtlsTransport#

dtlsTransport: RTCDtlsTransport

Defined in#

packages/webrtc/src/peerConnection.ts:67


iceConnectionState#

iceConnectionState: "closed" | "failed" | "disconnected" | "new" | "connected" | "checking" | "completed" = "new"

Defined in#

packages/webrtc/src/peerConnection.ts:73


iceConnectionStateChange#

Readonly iceConnectionStateChange: default<["closed" | "failed" | "disconnected" | "new" | "connected" | "checking" | "completed"]>

Defined in#

packages/webrtc/src/peerConnection.ts:79


iceGatheringState#

iceGatheringState: "new" | "gathering" | "complete" = "new"

Defined in#

packages/webrtc/src/peerConnection.ts:74


iceGatheringStateChange#

Readonly iceGatheringStateChange: default<["new" | "gathering" | "complete"]>

Defined in#

packages/webrtc/src/peerConnection.ts:78


iceTransport#

iceTransport: RTCIceTransport

Defined in#

packages/webrtc/src/peerConnection.ts:66


isClosed#

Private isClosed: boolean = false

Defined in#

packages/webrtc/src/peerConnection.ts:110


masterTransportEstablished#

masterTransportEstablished: boolean = false

Defined in#

packages/webrtc/src/peerConnection.ts:69


negotiationneeded#

negotiationneeded: boolean = false

Defined in#

packages/webrtc/src/peerConnection.ts:76


onDataChannel#

Readonly onDataChannel: default<[RTCDataChannel]>

Defined in#

packages/webrtc/src/peerConnection.ts:82


onIceCandidate#

Readonly onIceCandidate: default<[RTCIceCandidate]>

Defined in#

packages/webrtc/src/peerConnection.ts:90


onNegotiationneeded#

Readonly onNegotiationneeded: default<[]>

Defined in#

packages/webrtc/src/peerConnection.ts:91


onRemoteTransceiverAdded#

Readonly onRemoteTransceiverAdded: default<[RTCRtpTransceiver]>

Defined in#

packages/webrtc/src/peerConnection.ts:83


onTransceiver#

Readonly onTransceiver: default<[RTCRtpTransceiver]>

should use onRemoteTransceiverAdded

deprecated

Defined in#

packages/webrtc/src/peerConnection.ts:88


onTransceiverAdded#

Readonly onTransceiverAdded: default<[RTCRtpTransceiver]>

Defined in#

packages/webrtc/src/peerConnection.ts:89


onconnectionstatechange#

Optional onconnectionstatechange: Callback

Defined in#

packages/webrtc/src/peerConnection.ts:98


ondatachannel#

Optional ondatachannel: CallbackWithValue<RTCDataChannelEvent>

Defined in#

packages/webrtc/src/peerConnection.ts:93


onicecandidate#

Optional onicecandidate: CallbackWithValue<RTCPeerConnectionIceEvent>

Defined in#

packages/webrtc/src/peerConnection.ts:94


onnegotiationneeded#

Optional onnegotiationneeded: CallbackWithValue<any>

Defined in#

packages/webrtc/src/peerConnection.ts:95


onsignalingstatechange#

Optional onsignalingstatechange: CallbackWithValue<any>

Defined in#

packages/webrtc/src/peerConnection.ts:96


ontrack#

Optional ontrack: CallbackWithValue<RTCTrackEvent>

Defined in#

packages/webrtc/src/peerConnection.ts:97


pendingLocalDescription#

Private Optional pendingLocalDescription: SessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:108


pendingRemoteDescription#

Private Optional pendingRemoteDescription: SessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:109


remoteDtls#

Private Optional remoteDtls: RTCDtlsParameters

Defined in#

packages/webrtc/src/peerConnection.ts:103


remoteIce#

Private Optional remoteIce: RTCIceParameters

Defined in#

packages/webrtc/src/peerConnection.ts:104


router#

Private Readonly router: RtpRouter

Defined in#

packages/webrtc/src/peerConnection.ts:100


sctpRemotePort#

Private Optional sctpRemotePort: number

Defined in#

packages/webrtc/src/peerConnection.ts:102


sctpTransport#

Optional sctpTransport: RTCSctpTransport

Defined in#

packages/webrtc/src/peerConnection.ts:68


seenMid#

Private seenMid: Set<string>

Defined in#

packages/webrtc/src/peerConnection.ts:105


shouldNegotiationneeded#

Private shouldNegotiationneeded: boolean = false

Defined in#

packages/webrtc/src/peerConnection.ts:111


signalingState#

signalingState: "closed" | "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer" = "stable"

Defined in#

packages/webrtc/src/peerConnection.ts:75


signalingStateChange#

Readonly signalingStateChange: default<["closed" | "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer"]>

Defined in#

packages/webrtc/src/peerConnection.ts:80


transceivers#

Readonly transceivers: RTCRtpTransceiver[] = []

Defined in#

packages/webrtc/src/peerConnection.ts:77


captureRejectionSymbol#

Static Readonly captureRejectionSymbol: typeof captureRejectionSymbol

Inherited from#

EventTarget.captureRejectionSymbol

Defined in#

node_modules/@types/node/events.d.ts:43


captureRejections#

Static captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Inherited from#

EventTarget.captureRejections

Defined in#

node_modules/@types/node/events.d.ts:49


defaultMaxListeners#

Static defaultMaxListeners: number

Inherited from#

EventTarget.defaultMaxListeners

Defined in#

node_modules/@types/node/events.d.ts:50


errorMonitor#

Static Readonly errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Inherited from#

EventTarget.errorMonitor

Defined in#

node_modules/@types/node/events.d.ts:42

Accessors#

_localDescription#

Private get _localDescription(): undefined | SessionDescription

Returns#

undefined | SessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:179


_remoteDescription#

Private get _remoteDescription(): undefined | SessionDescription

Returns#

undefined | SessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:183


localDescription#

get localDescription(): undefined | RTCSessionDescription

Returns#

undefined | RTCSessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:169


remoteDescription#

get remoteDescription(): undefined | RTCSessionDescription

Returns#

undefined | RTCSessionDescription

Defined in#

packages/webrtc/src/peerConnection.ts:174

Methods#

addEventListener#

addEventListener(type, listener): void

Parameters#

NameType
typestring
listener(...args: any[]) => void

Returns#

void

Inherited from#

EventTarget.addEventListener

Defined in#

packages/webrtc/src/helper.ts:37


addIceCandidate#

addIceCandidate(candidateMessage): Promise<void>

Parameters#

NameType
candidateMessageRTCIceCandidate

Returns#

Promise<void>

Defined in#

packages/webrtc/src/peerConnection.ts:517


addListener#

addListener(event, listener): RTCPeerConnection

Parameters#

NameType
eventstring | symbol
listener(...args: any[]) => void

Returns#

RTCPeerConnection

Inherited from#

EventTarget.addListener

Defined in#

node_modules/@types/node/events.d.ts:62


addTrack#

addTrack(track, ms?): RTCRtpSender

Parameters#

NameType
trackMediaStreamTrack
ms?MediaStream

Returns#

RTCRtpSender

Defined in#

packages/webrtc/src/peerConnection.ts:867


addTransceiver#

addTransceiver(trackOrKind, options?): RTCRtpTransceiver

Parameters#

NameType
trackOrKindKind | MediaStreamTrack
optionsPartial<TransceiverOptions>

Returns#

RTCRtpTransceiver

Defined in#

packages/webrtc/src/peerConnection.ts:825


assertNotClosed#

Private assertNotClosed(): void

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:999


close#

close(): Promise<void>

Returns#

Promise<void>

Defined in#

packages/webrtc/src/peerConnection.ts:977


connect#

Private connect(): Promise<void>

Returns#

Promise<void>

Defined in#

packages/webrtc/src/peerConnection.ts:522


createAnswer#

createAnswer(): Promise<RTCSessionDescription>

Returns#

Promise<RTCSessionDescription>

Defined in#

packages/webrtc/src/peerConnection.ts:913


createDataChannel#

createDataChannel(label, options?): RTCDataChannel

Parameters#

NameType
labelstring
optionsPartial<Object>

Returns#

RTCDataChannel

Defined in#

packages/webrtc/src/peerConnection.ts:281


createOffer#

createOffer(): Promise<RTCSessionDescription>

Returns#

Promise<RTCSessionDescription>

Defined in#

packages/webrtc/src/peerConnection.ts:197


createSctpTransport#

Private createSctpTransport(): RTCSctpTransport

Returns#

RTCSctpTransport

Defined in#

packages/webrtc/src/peerConnection.ts:404


createTransport#

Private createTransport(srtpProfiles?): Object

Parameters#

NameTypeDefault value
srtpProfilesnumber[][]

Returns#

Object

NameType
dtlsTransportRTCDtlsTransport
iceTransportRTCIceTransport

Defined in#

packages/webrtc/src/peerConnection.ts:359


dispose#

Private dispose(): void

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:1032


emit#

emit(event, ...args): boolean

Parameters#

NameType
eventstring | symbol
...argsany[]

Returns#

boolean

Inherited from#

EventTarget.emit

Defined in#

node_modules/@types/node/events.d.ts:72


eventNames#

eventNames(): (string | symbol)[]

Returns#

(string | symbol)[]

Inherited from#

EventTarget.eventNames

Defined in#

node_modules/@types/node/events.d.ts:77


fireOnTrack#

Private fireOnTrack(track, transceiver, stream): void

Parameters#

NameType
trackMediaStreamTrack
transceiverRTCRtpTransceiver
streamMediaStream

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:810


getMaxListeners#

getMaxListeners(): number

Returns#

number

Inherited from#

EventTarget.getMaxListeners

Defined in#

node_modules/@types/node/events.d.ts:69


getReceivers#

getReceivers(): RTCRtpReceiver[]

Returns#

RTCRtpReceiver[]

Defined in#

packages/webrtc/src/peerConnection.ts:862


getSenders#

getSenders(): RTCRtpSender[]

Returns#

RTCRtpSender[]

Defined in#

packages/webrtc/src/peerConnection.ts:858


getTransceiverByMLineIndex#

Private getTransceiverByMLineIndex(index): undefined | RTCRtpTransceiver

Parameters#

NameType
indexnumber

Returns#

undefined | RTCRtpTransceiver

Defined in#

packages/webrtc/src/peerConnection.ts:191


getTransceiverByMid#

Private getTransceiverByMid(mid): undefined | RTCRtpTransceiver

Parameters#

NameType
midstring

Returns#

undefined | RTCRtpTransceiver

Defined in#

packages/webrtc/src/peerConnection.ts:187


getTransceivers#

getTransceivers(): RTCRtpTransceiver[]

Returns#

RTCRtpTransceiver[]

Defined in#

packages/webrtc/src/peerConnection.ts:854


listenerCount#

listenerCount(event): number

Parameters#

NameType
eventstring | symbol

Returns#

number

Inherited from#

EventTarget.listenerCount

Defined in#

node_modules/@types/node/events.d.ts:73


listeners#

listeners(event): Function[]

Parameters#

NameType
eventstring | symbol

Returns#

Function[]

Inherited from#

EventTarget.listeners

Defined in#

node_modules/@types/node/events.d.ts:70


localRtp#

Private localRtp(transceiver): RTCRtpParameters

Parameters#

NameType
transceiverRTCRtpTransceiver

Returns#

RTCRtpParameters

Defined in#

packages/webrtc/src/peerConnection.ts:548


needNegotiation#

Private needNegotiation(): Promise<void>

Returns#

Promise<void>

Defined in#

packages/webrtc/src/peerConnection.ts:348


off#

off(event, listener): RTCPeerConnection

Parameters#

NameType
eventstring | symbol
listener(...args: any[]) => void

Returns#

RTCPeerConnection

Inherited from#

EventTarget.off

Defined in#

node_modules/@types/node/events.d.ts:66


on#

on(event, listener): RTCPeerConnection

Parameters#

NameType
eventstring | symbol
listener(...args: any[]) => void

Returns#

RTCPeerConnection

Inherited from#

EventTarget.on

Defined in#

node_modules/@types/node/events.d.ts:63


once#

once(event, listener): RTCPeerConnection

Parameters#

NameType
eventstring | symbol
listener(...args: any[]) => void

Returns#

RTCPeerConnection

Inherited from#

EventTarget.once

Defined in#

node_modules/@types/node/events.d.ts:64


prependListener#

prependListener(event, listener): RTCPeerConnection

Parameters#

NameType
eventstring | symbol
listener(...args: any[]) => void

Returns#

RTCPeerConnection

Inherited from#

EventTarget.prependListener

Defined in#

node_modules/@types/node/events.d.ts:75


prependOnceListener#

prependOnceListener(event, listener): RTCPeerConnection

Parameters#

NameType
eventstring | symbol
listener(...args: any[]) => void

Returns#

RTCPeerConnection

Inherited from#

EventTarget.prependOnceListener

Defined in#

node_modules/@types/node/events.d.ts:76


rawListeners#

rawListeners(event): Function[]

Parameters#

NameType
eventstring | symbol

Returns#

Function[]

Inherited from#

EventTarget.rawListeners

Defined in#

node_modules/@types/node/events.d.ts:71


remoteRtp#

Private remoteRtp(remoteDescription, transceiver): RTCRtpReceiveParameters

Parameters#

NameType
remoteDescriptionSessionDescription
transceiverRTCRtpTransceiver

Returns#

RTCRtpReceiveParameters

Defined in#

packages/webrtc/src/peerConnection.ts:560


removeAllListeners#

removeAllListeners(event?): RTCPeerConnection

Parameters#

NameType
event?string | symbol

Returns#

RTCPeerConnection

Inherited from#

EventTarget.removeAllListeners

Defined in#

node_modules/@types/node/events.d.ts:67


removeEventListener#

removeEventListener(type, listener): void

Parameters#

NameType
typestring
listener(...args: any[]) => void

Returns#

void

Inherited from#

EventTarget.removeEventListener

Defined in#

packages/webrtc/src/helper.ts:41


removeListener#

removeListener(event, listener): RTCPeerConnection

Parameters#

NameType
eventstring | symbol
listener(...args: any[]) => void

Returns#

RTCPeerConnection

Inherited from#

EventTarget.removeListener

Defined in#

node_modules/@types/node/events.d.ts:65


removeTrack#

removeTrack(sender): void

Parameters#

NameType
senderRTCRtpSender

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:320


setConnectionState#

Private setConnectionState(state): void

Parameters#

NameType
state"closed" | "connecting" | "failed" | "disconnected" | "new" | "connected"

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:1024


setLocal#

Private setLocal(description): void

Parameters#

NameType
descriptionSessionDescription

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:508


setLocalDescription#

setLocalDescription(sessionDescription): Promise<SessionDescription>

Parameters#

NameType
sessionDescriptionObject
sessionDescription.sdpstring
sessionDescription.type"offer" | "answer"

Returns#

Promise<SessionDescription>

Defined in#

packages/webrtc/src/peerConnection.ts:419


setMaxListeners#

setMaxListeners(n): RTCPeerConnection

Parameters#

NameType
nnumber

Returns#

RTCPeerConnection

Inherited from#

EventTarget.setMaxListeners

Defined in#

node_modules/@types/node/events.d.ts:68


setRemoteDescription#

setRemoteDescription(sessionDescription): Promise<void>

Parameters#

NameType
sessionDescriptionObject
sessionDescription.sdpstring
sessionDescription.type"offer" | "answer"

Returns#

Promise<void>

Defined in#

packages/webrtc/src/peerConnection.ts:642


setSignalingState#

Private setSignalingState(state): void

Parameters#

NameType
state"closed" | "stable" | "have-local-offer" | "have-remote-offer" | "have-local-pranswer" | "have-remote-pranswer"

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:1017


updateIceConnectionState#

Private updateIceConnectionState(state): void

Parameters#

NameType
state"closed" | "failed" | "disconnected" | "new" | "connected" | "checking" | "completed"

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:1010


updateIceGatheringState#

Private updateIceGatheringState(state): void

Parameters#

NameType
state"new" | "gathering" | "complete"

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:1003


validateDescription#

Private validateDescription(description, isLocal): void

Parameters#

NameType
descriptionSessionDescription
isLocalboolean

Returns#

void

Defined in#

packages/webrtc/src/peerConnection.ts:588


listenerCount#

Static listenerCount(emitter, event): number

deprecated since v4.0.0

Parameters#

NameType
emitterEventEmitter
eventstring | symbol

Returns#

number

Inherited from#

EventTarget.listenerCount

Defined in#

node_modules/@types/node/events.d.ts:31


on#

Static on(emitter, event): AsyncIterableIterator<any>

Parameters#

NameType
emitterEventEmitter
eventstring

Returns#

AsyncIterableIterator<any>

Inherited from#

EventTarget.on

Defined in#

node_modules/@types/node/events.d.ts:28


once#

Static once(emitter, event): Promise<any[]>

Parameters#

NameType
emitterNodeEventTarget
eventstring | symbol

Returns#

Promise<any[]>

Inherited from#

EventTarget.once

Defined in#

node_modules/@types/node/events.d.ts:26

Static once(emitter, event): Promise<any[]>

Parameters#

NameType
emitterDOMEventTarget
eventstring

Returns#

Promise<any[]>

Inherited from#

EventTarget.once

Defined in#

node_modules/@types/node/events.d.ts:27