Skip to main content

PeerConnection

Extends​

Properties​

PropertyTypeDescriptionInherited from
peerExtendedRTCPeerConnection-BasePeerConnection.peer
connectionStateRTCPeerConnectionState-BasePeerConnection.connectionState
iceGatheringStateRTCIceGatheringState-BasePeerConnection.iceGatheringState
iceConnectionStateRTCIceConnectionState-BasePeerConnection.iceConnectionState
signalingStateRTCSignalingState-BasePeerConnection.signalingState
sendersRTCRtpSender[]-BasePeerConnection.senders
receiversRTCRtpReceiver[]-BasePeerConnection.receivers
bandwidthBandwidth-BasePeerConnection.bandwidth
hasICECandidatesboolean-BasePeerConnection.hasICECandidates
referencesReferencesReference of any logical associations to the peer connection for loggingBasePeerConnection.references
offerOptionsRTCOfferOptions | undefined-BasePeerConnection.offerOptions
answerOptionsRTCAnswerOptions | undefined-BasePeerConnection.answerOptions
politeboolean-BasePeerConnection.polite
configsMediaConfig[]-BasePeerConnection.configs
getTransceiverConfigs() => TransceiverConfig[]-BasePeerConnection.getTransceiverConfigs
getDataChannelConfigs() => DataChannelConfig[]-BasePeerConnection.getDataChannelConfigs
createDataChannel(label, dataChannelDict?) => RTCDataChannel-BasePeerConnection.createDataChannel
setConfiguration(configuration?) => void | undefinedOnly recently supported on some browser: https://caniuse.com/?search=setconfigurationBasePeerConnection.setConfiguration
getConfiguration() => RTCConfiguration-BasePeerConnection.getConfiguration
close() => void-BasePeerConnection.close
restartIce() => void-BasePeerConnection.restartIce
currentLocalDescriptionRTCSessionDescription | null--
pendingLocalDescription?RTCSessionDescription | RTCSessionDescriptionInitIt represents a local description that is in the process of being negotiated plus any local candidates that have been generated by the ICE Agent since the offer or answer was created. If the RTCPeerConnection is in the stable state, the value is null. https://w3c.github.io/webrtc-pc/#dom-peerconnection-pendinglocaldesc-
currentRemoteDescriptionRTCSessionDescription | null--
pendingRemoteDescriptionRTCSessionDescription | nullIt represents a remote description that is in the process of being negotiated, complete with any remote candidates that have been supplied via addIceCandidate() since the offer or answer was created. If the RTCPeerConnection is in the stable state, the value is null. https://w3c.github.io/webrtc-pc/#dom-peerconnection-pendingremotedesc-
negotiationNeededboolean--
onConnectionStateChange?EventHandler--
onDataChannel?(this, ev) => any | null--
onIceCandidate?OnIceCandidateHandler--
onIceCandidateError?(this, ev) => any | null--
onIceConnectionStateChange?EventHandler--
onIceGatheringStateChange?EventHandler--
onNegotiationNeeded?OnNegotiationNeededHandler--
onRemoteStreams?OnRemoteStreamsEventHandler--
onSignalingStateChange?EventHandler--
onTrack?OnTrackEventHandler--
onTransceiverChange?OnTransceiverChangeHandler--
onSecureCheckCode?OnSecureCheckCodeHandler--

Methods​

addConfig()​

Call Signature​

addConfig(peer, initOrConfig): DataChannelConfig;
Parameters​
ParameterType
peerRTCPeerConnection
initOrConfig| DataChannelConfig | DataChannelInit
Returns​

DataChannelConfig

Inherited from​

BasePeerConnection.addConfig

Call Signature​

addConfig(peer, initOrConfig): TransceiverConfig;
Parameters​
ParameterType
peerRTCPeerConnection
initOrConfig| TransceiverConfig | TransceiverInit
Returns​

TransceiverConfig

Inherited from​

BasePeerConnection.addConfig

Call Signature​

addConfig(peer, initOrConfig):
| TransceiverConfig
| DataChannelConfig;
Parameters​
ParameterType
peerRTCPeerConnection
initOrConfig| TransceiverConfig | DataChannelConfig | DataChannelInit | TransceiverInit
Returns​

| TransceiverConfig | DataChannelConfig

Inherited from​

BasePeerConnection.addConfig


setLocalStream()​

setLocalStream(
stream,
target,
shouldSyncMedia?): Promise<void>;

Parameters​

ParameterType
streamMediaStream | undefined
targetTransceiverConfigDirectionTuple[]
shouldSyncMedia?boolean

Returns​

Promise<void>

Inherited from​

BasePeerConnection.setLocalStream


getStats()​

getStats(selector?): Promise<RTCStatsReport>;

Parameters​

ParameterType
selector?MediaStreamTrack | null

Returns​

Promise<RTCStatsReport>

Inherited from​

BasePeerConnection.getStats


setReference()​

setReference(key, value): void;

Key/Value pair for referencing logical associations for logging

Parameters​

ParameterTypeDescription
keystringThe key for the reference
valuestringThe value for the reference

Returns​

void

Inherited from​

BasePeerConnection.setReference


createOffer()​

createOffer(options?): Promise<RTCSessionDescriptionInit>;

Parameters​

ParameterType
options?RTCOfferOptions

Returns​

Promise<RTCSessionDescriptionInit>


createAnswer()​

createAnswer(options?): Promise<RTCSessionDescriptionInit>;

Parameters​

ParameterType
options?RTCAnswerOptions

Returns​

Promise<RTCSessionDescriptionInit>


receiveIceCandidate()​

receiveIceCandidate(candidate): Promise<void>;

Parameters​

ParameterType
candidateRTCIceCandidate | RTCIceCandidateInit

Returns​

Promise<void>


releaseLocalICECandidatesBuffer()​

releaseLocalICECandidatesBuffer(ignore): void;

Parameters​

ParameterType
ignoreboolean

Returns​

void


receiveAnswer()​

receiveAnswer(answer): Promise<void>;

Parameters​

ParameterType
answerRTCSessionDescriptionInit

Returns​

Promise<void>


receiveOffer()​

receiveOffer(offer): Promise<void>;

Parameters​

ParameterType
offerRTCSessionDescriptionInit

Returns​

Promise<void>


negotiate()​

negotiate(): Promise<void>;

Returns​

Promise<void>