RTCPeerConnection extension type
The RTCPeerConnection
interface represents 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.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Constructors
- RTCPeerConnection([RTCConfiguration configuration])
-
factory
Properties
- canTrickleIceCandidates → bool?
-
The
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.no setter - connectionState → RTCPeerConnectionState
-
The
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
, orclosed
.no setter - currentLocalDescription → RTCSessionDescription?
-
The
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.no setter - currentRemoteDescription → RTCSessionDescription?
-
The
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.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- iceConnectionState → RTCIceConnectionState
-
The
iceConnectionState
read-only property of the RTCPeerConnection interface returns a string which state of the agent associated with the RTCPeerConnection:new
,checking
,connected
,completed
,failed
,disconnected
, andclosed
.no setter - iceGatheringState → RTCIceGatheringState
-
The
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.no setter - idpLoginUrl → String?
-
no setter
- isDefinedAndNotNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter - isNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptnull
.no setter - isTruthy → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!!
in JavaScript.this
no setter - isUndefined → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptundefined
.no setter - isUndefinedOrNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter - localDescription → RTCSessionDescription?
-
The
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 isnull
.no setter - not → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!
in JavaScript.this
no setter - onconnectionstatechange ↔ EventHandler?
-
getter/setter pair
- ondatachannel ↔ EventHandler?
-
getter/setter pair
- onicecandidate ↔ EventHandler?
-
getter/setter pair
- onicecandidateerror ↔ EventHandler?
-
getter/setter pair
- oniceconnectionstatechange ↔ EventHandler?
-
getter/setter pair
- onicegatheringstatechange ↔ EventHandler?
-
getter/setter pair
- onnegotiationneeded ↔ EventHandler?
-
getter/setter pair
- onsignalingstatechange ↔ EventHandler?
-
getter/setter pair
- ontrack ↔ EventHandler?
-
getter/setter pair
-
peerIdentity
→ JSPromise<
JSObject> -
The
peerIdentity
read-only property of the RTCPeerConnection interface returns a JavaScriptPromise
that resolves to anRTCIdentityAssertion
which contains a string identifying the remote peer. Once this promise resolves successfully, the resulting identity is the target peer identity and cannot change for the duration of the connection.no setter - pendingLocalDescription → RTCSessionDescription?
-
The
pendingLocalDescription
read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing a pending configuration change for the local end of the connection.no setter - pendingRemoteDescription → RTCSessionDescription?
-
The
pendingRemoteDescription
read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing a pending configuration change for the remote end of the connection.no setter - remoteDescription → RTCSessionDescription?
-
The
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 isnull
.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sctp → RTCSctpTransport?
-
The
sctp
read-only property of the RTCPeerConnection interface returns an RTCSctpTransport describing the transport over which SCTP data is being sent and received. If SCTP hasn't been negotiated, this value isnull
.no setter - signalingState → RTCSignalingState
-
The
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.no setter
Methods
-
add(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
+any
-
addEventListener(
String type, EventListener? callback, [JSAny 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.inherited -
addIceCandidate(
[RTCIceCandidateInit candidate, VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback]) → JSPromise< JSAny?> -
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. -
addTrack(
MediaStreamTrack track, MediaStream 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. -
addTransceiver(
JSAny trackOrKind, [RTCRtpTransceiverInit init]) → RTCRtpTransceiver -
The
addTransceiver()
method of the RTCPeerConnection interface creates a new RTCRtpTransceiver and adds it to the set of transceivers associated with theRTCPeerConnection
. Each transceiver represents a bidirectional stream, with both an RTCRtpSender and an RTCRtpReceiver associated with it. -
and(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
&&any
-
callMethod<
R extends JSAny?> (JSAny method, [JSAny? arg1, JSAny? arg2, JSAny? arg3, JSAny? arg4]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethod
on this JSObject with up to four arguments. -
callMethodVarArgs<
R extends JSAny?> (JSAny method, [List< JSAny?> ? arguments]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethod
on this JSObject with a variable number ofarguments
. -
close(
) → void -
The
close()
method of the RTCPeerConnection interface closes the current peer connection. -
createAnswer(
[JSObject optionsOrSuccessCallback, RTCPeerConnectionErrorCallback failureCallback]) → JSPromise< RTCSessionDescriptionInit?> -
The
createAnswer()
method of the RTCPeerConnection interface creates an answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection. -
createDataChannel(
String label, [RTCDataChannelInit 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. -
createOffer(
[JSObject optionsOrSuccessCallback, RTCPeerConnectionErrorCallback failureCallback, RTCOfferOptions options]) → JSPromise< RTCSessionDescriptionInit?> -
The
createOffer()
method of the RTCPeerConnection interface initiates the creation of an offer for the purpose of starting a new WebRTC connection to a remote peer. -
dartify(
) → Object? -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Converts a JavaScript value to the Dart equivalent if possible. -
delete(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Deletes the property with keyproperty
from this JSObject. -
dispatchEvent(
Event event) → bool -
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 withdispatchEvent()
.inherited -
divide(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
/any
-
equals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
==any
-
exponentiate(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
**any
-
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. -
getIdentityAssertion(
) → JSPromise< JSString> -
The
getIdentityAssertion()
method of the RTCPeerConnection interface initiates the gathering of an identity assertion. This has an effect only if the RTCPeerConnection.signalingState is not"closed"
. -
getProperty<
R extends JSAny?> (JSAny property) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
The value of the property keyproperty
of this JSObject. -
getReceivers(
) → JSArray< 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. -
getSenders(
) → JSArray< 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. -
getStats(
[MediaStreamTrack? selector]) → JSPromise< 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. -
getTransceivers(
) → JSArray< 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. -
greaterThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>any
-
greaterThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>=any
-
has(
String property) → bool -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for hasProperty to check whether this JSObject contains the property keyproperty
, but takes and returns a Dart value. -
hasProperty(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Whether or not this JSObject contains the property keyproperty
. -
instanceof(
JSFunction constructor) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is aninstanceof
constructor
. -
instanceOfString(
String constructorName) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is aninstanceof
the constructor that is defined byconstructorName
, which is looked up in the globalContext. -
isA<
T extends JSAny?> () → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is an instance of the JavaScript type that is declared byT
. -
lessThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
<any
-
lessThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
<=any
-
modulo(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
%any
-
multiply(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
*any
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
!=any
-
or(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
||any
-
removeEventListener(
String type, EventListener? callback, [JSAny 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.inherited -
removeTrack(
RTCRtpSender 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. -
restartIce(
) → void -
The
restartIce()
method of the RTCPeerConnection interface allows a web application to request that 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. -
setConfiguration(
[RTCConfiguration 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. -
setIdentityProvider(
String provider, [RTCIdentityProviderOptions options]) → void -
The
setIdentityProvider()
method of the RTCPeerConnection interface sets the Identity Provider (IdP) to the triplet given in parameter: its name, the protocol used to communicate with it (optional) and an optional username. The IdP will be used only when an assertion is needed. -
setLocalDescription(
[RTCLocalSessionDescriptionInit description, VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback]) → JSPromise< JSAny?> -
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 aPromise
which is fulfilled once the description has been changed, asynchronously. -
setProperty(
JSAny property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Write thevalue
of property keyproperty
of this JSObject. -
setRemoteDescription(
RTCSessionDescriptionInit description, [VoidFunction successCallback, RTCPeerConnectionErrorCallback failureCallback]) → JSPromise< JSAny?> -
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 aPromise
which is fulfilled once the description has been changed, asynchronously. -
strictEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
===any
-
strictNotEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
!==any
-
subtract(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
-any
-
toString(
) → String -
A string representation of this object.
inherited
-
typeofEquals(
String typeString) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether the result oftypeof
on thisJSAny?
istypeString
. -
unsignedRightShift(
JSAny? any) → JSNumber -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>>>any
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String property) → JSAny? -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for getProperty to get the value of the property keyproperty
of this JSObject, but takes and returns a Dart value. -
operator []=(
String property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for setProperty to write thevalue
of the property keyproperty
of this JSObject, but takes a Dart value.
Static Methods
-
generateCertificate(
AlgorithmIdentifier keygenAlgorithm) → JSPromise< RTCCertificate> -
The
generateCertificate()
static function of the RTCPeerConnection interface creates an X.509 certificate and corresponding private key, returning a promise that resolves with the new RTCCertificate once it's generated.