RTCPeerConnection
A WebRTC connection between the local computer and a remote peer. It provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed.
interface RTCPeerConnection extends EventTarget {
readonly canTrickleIceCandidates: boolean | null;
readonly connectionState: RTCPeerConnectionState;
readonly currentLocalDescription: RTCSessionDescription | null;
readonly currentRemoteDescription: RTCSessionDescription | null;
readonly iceConnectionState: RTCIceConnectionState;
readonly iceGatheringState: RTCIceGatheringState;
readonly localDescription: RTCSessionDescription | null;
onconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
ondatachannel: ((this: RTCPeerConnection, ev: RTCDataChannelEvent) => any) | null;
onicecandidate: ((this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any) | null;
onicecandidateerror: ((this: RTCPeerConnection, ev: Event) => any) | null;
oniceconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
onicegatheringstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
onnegotiationneeded: ((this: RTCPeerConnection, ev: Event) => any) | null;
onsignalingstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null;
ontrack: ((this: RTCPeerConnection, ev: RTCTrackEvent) => any) | null;
readonly pendingLocalDescription: RTCSessionDescription | null;
readonly pendingRemoteDescription: RTCSessionDescription | null;
readonly remoteDescription: RTCSessionDescription | null;
readonly sctp: RTCSctpTransport | null;
readonly signalingState: RTCSignalingState;
addEventListener<K extends keyof RTCPeerConnectionEventMap>(
type: K,
listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;addIceCandidate(candidate?: RTCIceCandidateInit): Promise<void>;
addIceCandidate(
candidate: RTCIceCandidateInit,
successCallback: VoidFunction,
failureCallback: RTCPeerConnectionErrorCallback,
): Promise<void>;addTransceiver(trackOrKind: MediaStreamTrack | string, init?: RTCRtpTransceiverInit): RTCRtpTransceiver;
close(): void;
createAnswer(options?: RTCAnswerOptions): Promise<RTCSessionDescriptionInit>;
createAnswer(successCallback: RTCSessionDescriptionCallback, failureCallback: RTCPeerConnectionErrorCallback): Promise<void>;
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>;
createOffer(
successCallback: RTCSessionDescriptionCallback,
failureCallback: RTCPeerConnectionErrorCallback,
options?: RTCOfferOptions,
): Promise<void>;getConfiguration(): RTCConfiguration;
getReceivers(): RTCRtpReceiver[];
getSenders(): RTCRtpSender[];
getStats(selector?: MediaStreamTrack | null): Promise<RTCStatsReport>;
getTransceivers(): RTCRtpTransceiver[];
removeEventListener<K extends keyof RTCPeerConnectionEventMap>(
type: K,
listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;removeTrack(sender: RTCRtpSender): void;
restartIce(): void;
setConfiguration(configuration?: RTCConfiguration): void;
setLocalDescription(description?: RTCLocalSessionDescriptionInit): Promise<void>;
setLocalDescription(
description: RTCLocalSessionDescriptionInit,
successCallback: VoidFunction,
failureCallback: RTCPeerConnectionErrorCallback,
): Promise<void>;setRemoteDescription(description: RTCSessionDescriptionInit): Promise<void>;
setRemoteDescription(
}description: RTCSessionDescriptionInit,
successCallback: VoidFunction,
failureCallback: RTCPeerConnectionErrorCallback,
): Promise<void>;var RTCPeerConnection: {
prototype: RTCPeerConnection;
new (configuration?: RTCConfiguration): RTCPeerConnection;
generateCertificate(keygenAlgorithm: AlgorithmIdentifier): Promise<RTCCertificate>;
};§Extends
§Properties
§
readonly connectionState: RTCPeerConnectionState
[src]§
readonly currentLocalDescription: RTCSessionDescription | null
[src]§
readonly currentRemoteDescription: RTCSessionDescription | null
[src]§
readonly iceConnectionState: RTCIceConnectionState
[src]§
readonly iceGatheringState: RTCIceGatheringState
[src]§
readonly localDescription: RTCSessionDescription | null
[src]§
onconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null
[src]§
ondatachannel: ((this: RTCPeerConnection, ev: RTCDataChannelEvent) => any) | null
[src]§
onicecandidate: ((this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent) => any) | null
[src]§
onicecandidateerror: ((this: RTCPeerConnection, ev: Event) => any) | null
[src]§
oniceconnectionstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null
[src]§
onicegatheringstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null
[src]§
onnegotiationneeded: ((this: RTCPeerConnection, ev: Event) => any) | null
[src]§
onsignalingstatechange: ((this: RTCPeerConnection, ev: Event) => any) | null
[src]§
ontrack: ((this: RTCPeerConnection, ev: RTCTrackEvent) => any) | null
[src]§
readonly pendingLocalDescription: RTCSessionDescription | null
[src]§
readonly pendingRemoteDescription: RTCSessionDescription | null
[src]§
readonly remoteDescription: RTCSessionDescription | null
[src]§
readonly sctp: RTCSctpTransport | null
[src]§
readonly signalingState: RTCSignalingState
[src]§Methods
§
addEventListener<K extends keyof RTCPeerConnectionEventMap>(
[src]type: K,
listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void§
addEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void§
addIceCandidate(candidate?: RTCIceCandidateInit): Promise<void>
[src]§
addIceCandidate(
[src]candidate: RTCIceCandidateInit,
successCallback: VoidFunction,
failureCallback: RTCPeerConnectionErrorCallback,
): Promise<void>§
addTransceiver(trackOrKind: MediaStreamTrack | string, init?: RTCRtpTransceiverInit): RTCRtpTransceiver
[src]§
createAnswer(options?: RTCAnswerOptions): Promise<RTCSessionDescriptionInit>
[src]§
createAnswer(successCallback: RTCSessionDescriptionCallback, failureCallback: RTCPeerConnectionErrorCallback): Promise<void>
[src]§
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>
[src]§
createOffer(
[src]successCallback: RTCSessionDescriptionCallback,
failureCallback: RTCPeerConnectionErrorCallback,
options?: RTCOfferOptions,
): Promise<void>§
getConfiguration(): RTCConfiguration
[src]§
getReceivers(): RTCRtpReceiver[]
[src]§
getSenders(): RTCRtpSender[]
[src]§
getStats(selector?: MediaStreamTrack | null): Promise<RTCStatsReport>
[src]§
getTransceivers(): RTCRtpTransceiver[]
[src]§
removeEventListener<K extends keyof RTCPeerConnectionEventMap>(
[src]type: K,
listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void§
removeEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void§
removeTrack(sender: RTCRtpSender): void
[src]§
setConfiguration(configuration?: RTCConfiguration): void
[src]§
setLocalDescription(description?: RTCLocalSessionDescriptionInit): Promise<void>
[src]§
setLocalDescription(
[src]description: RTCLocalSessionDescriptionInit,
successCallback: VoidFunction,
failureCallback: RTCPeerConnectionErrorCallback,
): Promise<void>§
setRemoteDescription(description: RTCSessionDescriptionInit): Promise<void>
[src]§
setRemoteDescription(
[src]description: RTCSessionDescriptionInit,
successCallback: VoidFunction,
failureCallback: RTCPeerConnectionErrorCallback,
): Promise<void>