Skip to main content

ExtendedRTCPeerConnection

Extends​

  • RTCPeerConnection

Properties​

PropertyModifierTypeDescriptionInherited from
peerIdentitypublicPromise<unknown>--
canTrickleIceCandidatesreadonlyboolean | nullThe canTrickleIceCandidates read-only property of the RTCPeerConnection interface returns a boolean value which indicates whether or not the remote peer can accept trickled ICE candidates. MDN ReferenceRTCPeerConnection.canTrickleIceCandidates
connectionStatereadonlyRTCPeerConnectionStateThe connectionState read-only property of the RTCPeerConnection interface indicates the current state of the peer connection by returning one of the following string values: new, connecting, connected, disconnected, failed, or closed. MDN ReferenceRTCPeerConnection.connectionState
currentLocalDescriptionreadonlyRTCSessionDescription | nullThe currentLocalDescription read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing the local end of the connection as it was most recently successfully negotiated since the last time the RTCPeerConnection finished negotiating and connecting to a remote peer. Also included is a list of any ICE candidates that may already have been generated by the ICE agent since the offer or answer represented by the description was first instantiated. MDN ReferenceRTCPeerConnection.currentLocalDescription
currentRemoteDescriptionreadonlyRTCSessionDescription | nullThe currentRemoteDescription read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing the remote end of the connection as it was most recently successfully negotiated since the last time the RTCPeerConnection finished negotiating and connecting to a remote peer. Also included is a list of any ICE candidates that may already have been generated by the ICE agent since the offer or answer represented by the description was first instantiated. MDN ReferenceRTCPeerConnection.currentRemoteDescription
iceConnectionStatereadonlyRTCIceConnectionStateThe iceConnectionState read-only property of the RTCPeerConnection interface returns a string which state of the ICE agent associated with the RTCPeerConnection: new, checking, connected, completed, failed, disconnected, and closed. MDN ReferenceRTCPeerConnection.iceConnectionState
iceGatheringStatereadonlyRTCIceGatheringStateThe iceGatheringState read-only property of the RTCPeerConnection interface returns a string that describes the overall ICE gathering state for this connection. This lets you detect, for example, when collection of ICE candidates has finished. MDN ReferenceRTCPeerConnection.iceGatheringState
localDescriptionreadonlyRTCSessionDescription | nullThe localDescription read-only property of the RTCPeerConnection interface returns an RTCSessionDescription describing the session for the local end of the connection. If it has not yet been set, this is null. MDN ReferenceRTCPeerConnection.localDescription
onconnectionstatechangepublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.onconnectionstatechange
ondatachannelpublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.ondatachannel
onicecandidatepublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.onicecandidate
onicecandidateerrorpublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.onicecandidateerror
oniceconnectionstatechangepublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.oniceconnectionstatechange
onicegatheringstatechangepublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.onicegatheringstatechange
onnegotiationneededpublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.onnegotiationneeded
onsignalingstatechangepublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.onsignalingstatechange
ontrackpublic(this, ev) => any | nullMDN ReferenceRTCPeerConnection.ontrack
pendingLocalDescriptionreadonlyRTCSessionDescription | nullThe pendingLocalDescription read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing a pending configuration change for the local end of the connection. MDN ReferenceRTCPeerConnection.pendingLocalDescription
pendingRemoteDescriptionreadonlyRTCSessionDescription | nullThe pendingRemoteDescription read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing a pending configuration change for the remote end of the connection. MDN ReferenceRTCPeerConnection.pendingRemoteDescription
remoteDescriptionreadonlyRTCSessionDescription | nullThe remoteDescription read-only property of the RTCPeerConnection interface returns a RTCSessionDescription describing the session (which includes configuration and media information) for the remote end of the connection. If this hasn't been set yet, this is null. MDN ReferenceRTCPeerConnection.remoteDescription
sctpreadonlyRTCSctpTransport | nullThe sctp read-only property of the RTCPeerConnection interface returns an RTCSctpTransport describing the SCTP transport over which SCTP data is being sent and received. If SCTP hasn't been negotiated, this value is null. MDN ReferenceRTCPeerConnection.sctp
signalingStatereadonlyRTCSignalingStateThe signalingState read-only property of the RTCPeerConnection interface returns a string value describing the state of the signaling process on the local end of the connection while connecting or reconnecting to another peer. See Signaling in our WebRTC session lifetime page. MDN ReferenceRTCPeerConnection.signalingState

Methods​

restartIce()​

restartIce(): void;

Typescript DOM type definition has not included this method for RTCPeerConnection, thus patch it manually.

Allow a web application to easily request that ICE candidate gathering be redone on both ends of the connection. This simplifies the process by allowing the same method to be used by either the caller or the receiver to trigger an ICE restart.

https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/restartIce

Returns​

void

Overrides​

RTCPeerConnection.restartIce

dispatchEvent()​

dispatchEvent(event): boolean;

The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

MDN Reference

Parameters​

ParameterType
eventEvent

Returns​

boolean

Inherited from​

RTCPeerConnection.dispatchEvent

addIceCandidate()​

Call Signature​

addIceCandidate(candidate?): Promise<void>;

The addIceCandidate() method of the RTCPeerConnection interface adds a new remote candidate to the connection's remote description, which describes the state of the remote end of the connection.

MDN Reference

Parameters​
ParameterType
candidate?RTCIceCandidateInit | null
Returns​

Promise<void>

Inherited from​
RTCPeerConnection.addIceCandidate

Call Signature​

addIceCandidate(
candidate,
successCallback,
failureCallback): Promise<void>;
Parameters​
ParameterType
candidateRTCIceCandidateInit | null
successCallbackVoidFunction
failureCallbackRTCPeerConnectionErrorCallback
Returns​

Promise<void>

Deprecated​
Inherited from​
RTCPeerConnection.addIceCandidate

addTrack()​

addTrack(track, ...streams): RTCRtpSender;

The addTrack() method of the RTCPeerConnection interface adds a new media track to the set of tracks which will be transmitted to the other peer.

MDN Reference

Parameters​

ParameterType
trackMediaStreamTrack
...streamsMediaStream[]

Returns​

RTCRtpSender

Inherited from​

RTCPeerConnection.addTrack

addTransceiver()​

addTransceiver(trackOrKind, init?): RTCRtpTransceiver;

The addTransceiver() method of the RTCPeerConnection interface creates a new RTCRtpTransceiver and adds it to the set of transceivers associated with the RTCPeerConnection. Each transceiver represents a bidirectional stream, with both an RTCRtpSender and an RTCRtpReceiver associated with it.

MDN Reference

Parameters​

ParameterType
trackOrKindstring | MediaStreamTrack
init?RTCRtpTransceiverInit

Returns​

RTCRtpTransceiver

Inherited from​

RTCPeerConnection.addTransceiver

close()​

close(): void;

The close() method of the RTCPeerConnection interface closes the current peer connection.

MDN Reference

Returns​

void

Inherited from​

RTCPeerConnection.close

createAnswer()​

Call Signature​

createAnswer(options?): Promise<RTCSessionDescriptionInit>;

The createAnswer() method of the RTCPeerConnection interface creates an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection.

MDN Reference

Parameters​
ParameterType
options?RTCAnswerOptions
Returns​

Promise<RTCSessionDescriptionInit>

Inherited from​
RTCPeerConnection.createAnswer

Call Signature​

createAnswer(successCallback, failureCallback): Promise<void>;
Parameters​
ParameterType
successCallbackRTCSessionDescriptionCallback
failureCallbackRTCPeerConnectionErrorCallback
Returns​

Promise<void>

Deprecated​
Inherited from​
RTCPeerConnection.createAnswer

createDataChannel()​

createDataChannel(label, dataChannelDict?): RTCDataChannel;

The createDataChannel() method of the RTCPeerConnection interface creates a new channel linked with the remote peer, over which any kind of data may be transmitted. This can be useful for back-channel content, such as images, file transfer, text chat, game update packets, and so forth.

MDN Reference

Parameters​

ParameterType
labelstring
dataChannelDict?RTCDataChannelInit

Returns​

RTCDataChannel

Inherited from​

RTCPeerConnection.createDataChannel

createOffer()​

Call Signature​

createOffer(options?): Promise<RTCSessionDescriptionInit>;

The createOffer() method of the RTCPeerConnection interface initiates the creation of an SDP offer for the purpose of starting a new WebRTC connection to a remote peer.

MDN Reference

Parameters​
ParameterType
options?RTCOfferOptions
Returns​

Promise<RTCSessionDescriptionInit>

Inherited from​
RTCPeerConnection.createOffer

Call Signature​

createOffer(
successCallback,
failureCallback,
options?): Promise<void>;
Parameters​
ParameterType
successCallbackRTCSessionDescriptionCallback
failureCallbackRTCPeerConnectionErrorCallback
options?RTCOfferOptions
Returns​

Promise<void>

Deprecated​
Inherited from​
RTCPeerConnection.createOffer

getConfiguration()​

getConfiguration(): RTCConfiguration;

The getConfiguration() method of the RTCPeerConnection interface returns an object which indicates the current configuration of the RTCPeerConnection on which the method is called.

MDN Reference

Returns​

RTCConfiguration

Inherited from​

RTCPeerConnection.getConfiguration

getReceivers()​

getReceivers(): RTCRtpReceiver[];

The getReceivers() method of the RTCPeerConnection interface returns an array of RTCRtpReceiver objects, each of which represents one RTP receiver. Each RTP receiver manages the reception and decoding of data for a MediaStreamTrack on an RTCPeerConnection.

MDN Reference

Returns​

RTCRtpReceiver[]

Inherited from​

RTCPeerConnection.getReceivers

getSenders()​

getSenders(): RTCRtpSender[];

The getSenders() method of the RTCPeerConnection interface returns an array of RTCRtpSender objects, each of which represents the RTP sender responsible for transmitting one track's data. A sender object provides methods and properties for examining and controlling the encoding and transmission of the track's data.

MDN Reference

Returns​

RTCRtpSender[]

Inherited from​

RTCPeerConnection.getSenders

getStats()​

getStats(selector?): Promise<RTCStatsReport>;

The getStats() method of the RTCPeerConnection interface returns a promise which resolves with data providing statistics about either the overall connection or about the specified MediaStreamTrack.

MDN Reference

Parameters​

ParameterType
selector?MediaStreamTrack | null

Returns​

Promise<RTCStatsReport>

Inherited from​

RTCPeerConnection.getStats

getTransceivers()​

getTransceivers(): RTCRtpTransceiver[];

The getTransceivers() method of the RTCPeerConnection interface returns a list of the RTCRtpTransceiver objects being used to send and receive data on the connection.

MDN Reference

Returns​

RTCRtpTransceiver[]

Inherited from​

RTCPeerConnection.getTransceivers

removeTrack()​

removeTrack(sender): void;

The removeTrack() method of the RTCPeerConnection interface tells the local end of the connection to stop sending media from the specified track, without actually removing the corresponding RTCRtpSender from the list of senders as reported by RTCPeerConnection.getSenders(). If the track is already stopped, or is not in the connection's senders list, this method has no effect.

MDN Reference

Parameters​

ParameterType
senderRTCRtpSender

Returns​

void

Inherited from​

RTCPeerConnection.removeTrack

setConfiguration()​

setConfiguration(configuration?): void;

The setConfiguration() method of the RTCPeerConnection interface sets the current configuration of the connection based on the values included in the specified object. This lets you change the ICE servers used by the connection and which transport policies to use.

MDN Reference

Parameters​

ParameterType
configuration?RTCConfiguration

Returns​

void

Inherited from​

RTCPeerConnection.setConfiguration

setLocalDescription()​

Call Signature​

setLocalDescription(description?): Promise<void>;

The setLocalDescription() method of the RTCPeerConnection interface changes the local description associated with the connection. This description specifies the properties of the local end of the connection, including the media format. The method takes a single parameter—the session description—and it returns a Promise which is fulfilled once the description has been changed, asynchronously.

MDN Reference

Parameters​
ParameterType
description?RTCLocalSessionDescriptionInit
Returns​

Promise<void>

Inherited from​
RTCPeerConnection.setLocalDescription

Call Signature​

setLocalDescription(
description,
successCallback,
failureCallback): Promise<void>;
Parameters​
ParameterType
descriptionRTCLocalSessionDescriptionInit
successCallbackVoidFunction
failureCallbackRTCPeerConnectionErrorCallback
Returns​

Promise<void>

Deprecated​
Inherited from​
RTCPeerConnection.setLocalDescription

setRemoteDescription()​

Call Signature​

setRemoteDescription(description): Promise<void>;

The setRemoteDescription() method of the RTCPeerConnection interface sets the specified session description as the remote peer's current offer or answer. The description specifies the properties of the remote end of the connection, including the media format. The method takes a single parameter—the session description—and it returns a Promise which is fulfilled once the description has been changed, asynchronously.

MDN Reference

Parameters​
ParameterType
descriptionRTCSessionDescriptionInit
Returns​

Promise<void>

Inherited from​
RTCPeerConnection.setRemoteDescription

Call Signature​

setRemoteDescription(
description,
successCallback,
failureCallback): Promise<void>;
Parameters​
ParameterType
descriptionRTCSessionDescriptionInit
successCallbackVoidFunction
failureCallbackRTCPeerConnectionErrorCallback
Returns​

Promise<void>

Deprecated​
Inherited from​
RTCPeerConnection.setRemoteDescription

addEventListener()​

Call Signature​

addEventListener<K>(
type,
listener,
options?): void;

The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

MDN Reference

Type Parameters​
Type Parameter
K extends keyof RTCPeerConnectionEventMap
Parameters​
ParameterType
typeK
listener(this, ev) => any
options?boolean | AddEventListenerOptions
Returns​

void

Inherited from​
RTCPeerConnection.addEventListener

Call Signature​

addEventListener(
type,
listener,
options?): void;

The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

MDN Reference

Parameters​
ParameterType
typestring
listenerEventListenerOrEventListenerObject
options?boolean | AddEventListenerOptions
Returns​

void

Inherited from​
RTCPeerConnection.addEventListener

removeEventListener()​

Call Signature​

removeEventListener<K>(
type,
listener,
options?): void;

The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

MDN Reference

Type Parameters​
Type Parameter
K extends keyof RTCPeerConnectionEventMap
Parameters​
ParameterType
typeK
listener(this, ev) => any
options?boolean | EventListenerOptions
Returns​

void

Inherited from​
RTCPeerConnection.removeEventListener

Call Signature​

removeEventListener(
type,
listener,
options?): void;

The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

MDN Reference

Parameters​
ParameterType
typestring
listenerEventListenerOrEventListenerObject
options?boolean | EventListenerOptions
Returns​

void

Inherited from​
RTCPeerConnection.removeEventListener