Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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,
options?: boolean | AddEventListenerOptions,
): void;
addIceCandidate(candidate?: RTCIceCandidateInit): Promise<void>;
addIceCandidate(
successCallback: VoidFunction,
): Promise<void>;
addTrack(track: MediaStreamTrack, ...streams: MediaStream[]): RTCRtpSender;
addTransceiver(trackOrKind: MediaStreamTrack | string, init?: RTCRtpTransceiverInit): RTCRtpTransceiver;
close(): void;
createAnswer(options?: RTCAnswerOptions): Promise<RTCSessionDescriptionInit>;
createAnswer(successCallback: RTCSessionDescriptionCallback, failureCallback: RTCPeerConnectionErrorCallback): Promise<void>;
createDataChannel(label: string, dataChannelDict?: RTCDataChannelInit): RTCDataChannel;
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>;
createOffer(
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,
options?: boolean | EventListenerOptions,
): void;
removeTrack(sender: RTCRtpSender): void;
restartIce(): void;
setConfiguration(configuration?: RTCConfiguration): void;
setLocalDescription(description?: RTCLocalSessionDescriptionInit): Promise<void>;
setLocalDescription(
successCallback: VoidFunction,
): Promise<void>;
setRemoteDescription(description: RTCSessionDescriptionInit): Promise<void>;
setRemoteDescription(
successCallback: VoidFunction,
): Promise<void>;
}
var RTCPeerConnection: {
prototype: RTCPeerConnection;
new (configuration?: RTCConfiguration): RTCPeerConnection;
generateCertificate(keygenAlgorithm: AlgorithmIdentifier): Promise<RTCCertificate>;
}
;

§Extends

§Properties

§
readonly canTrickleIceCandidates: boolean | null
[src]
§
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>(
type: K,
listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addIceCandidate(candidate?: RTCIceCandidateInit): Promise<void>
[src]
§
addIceCandidate(
successCallback: VoidFunction,
): Promise<void>
[src]
§
addTrack(track: MediaStreamTrack, ...streams: MediaStream[]): RTCRtpSender
[src]
§
addTransceiver(trackOrKind: MediaStreamTrack | string, init?: RTCRtpTransceiverInit): RTCRtpTransceiver
[src]
§
close(): void
[src]
§
createAnswer(options?: RTCAnswerOptions): Promise<RTCSessionDescriptionInit>
[src]
§
createAnswer(successCallback: RTCSessionDescriptionCallback, failureCallback: RTCPeerConnectionErrorCallback): Promise<void>
[src]
§
createDataChannel(label: string, dataChannelDict?: RTCDataChannelInit): RTCDataChannel
[src]
§
createOffer(options?: RTCOfferOptions): Promise<RTCSessionDescriptionInit>
[src]
§
createOffer(
options?: RTCOfferOptions,
): Promise<void>
[src]
§
getConfiguration(): RTCConfiguration
[src]
§
getReceivers(): RTCRtpReceiver[]
[src]
§
getSenders(): RTCRtpSender[]
[src]
§
getStats(selector?: MediaStreamTrack | null): Promise<RTCStatsReport>
[src]
§
getTransceivers(): RTCRtpTransceiver[]
[src]
§
removeEventListener<K extends keyof RTCPeerConnectionEventMap>(
type: K,
listener: (this: RTCPeerConnection, ev: RTCPeerConnectionEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
[src]
§
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void
[src]
§
removeTrack(sender: RTCRtpSender): void
[src]
§
restartIce(): void
[src]
§
setConfiguration(configuration?: RTCConfiguration): void
[src]
§
setLocalDescription(description?: RTCLocalSessionDescriptionInit): Promise<void>
[src]
§
setLocalDescription(
successCallback: VoidFunction,
): Promise<void>
[src]
§
setRemoteDescription(description: RTCSessionDescriptionInit): Promise<void>
[src]
§
setRemoteDescription(
successCallback: VoidFunction,
): Promise<void>
[src]