Class

org.scalajs.dom.experimental.webrtc

RTCPeerConnection

Related Doc: package webrtc

Permalink

class RTCPeerConnection extends raw.EventTarget

The RTCPeerConnection interface represents a WebRTC connection between the local computer and a remote peer. It is used to handle efficient streaming of data between the two peers.

MDN

Annotations
@RawJSType() @native()
Linear Supertypes
raw.EventTarget, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. RTCPeerConnection
  2. EventTarget
  3. Object
  4. Any
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RTCPeerConnection(configuration: UndefOr[RTCConfiguration] = js.undefined)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addEventListener[T <: raw.Event](type: String, listener: Function1[T, _], useCapture: Boolean = js.native): Unit

    Permalink

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on.

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

    MDN

    Definition Classes
    EventTarget
  5. def addIceCandidate(candidate: RTCIceCandidate): Promise[Unit]

    Permalink

    The addIceCandidate() method provides a remote candidate to the ICE Agent.

    The addIceCandidate() method provides a remote candidate to the ICE Agent. In addition to being added to the remote description, connectivity checks will be sent to the new candidates as long as the "IceTransports" constraint is not set to "none". This call will result in a change to the connection state of the ICE Agent, and may result in a change to media state if it results in different connectivity being established.

    MDN

  6. def addStream(stream: MediaStream): Unit

    Permalink

    Adds a MediaStream as a local source of audio or video.

    Adds a MediaStream as a local source of audio or video. If the negotiation already happened, a new one will be needed for the remote peer to be able to use it.

    MDN

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. val canTrickleIceCandidates: Any

    Permalink

    This attribute indicates whether the remote peer is able to accept trickled ICE candidates [TRICKLE-ICE].

    This attribute indicates whether the remote peer is able to accept trickled ICE candidates [TRICKLE-ICE]. The value is determined based on whether a remote description indicates support for trickle ICE, as defined in Section 4.1.9 of [RTCWEB-JSEP]. Prior to the completion of setRemoteDescription, this value is null.

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def close(): Unit

    Permalink

    Abruptly closes a connection.

    Abruptly closes a connection.

    MDN

  11. def createAnswer(): Promise[RTCSessionDescription]

    Permalink

    The createAnswer method generates an [SDP] answer with the supported configuration for the session that is compatible with the parameters in the remote configuration.

    The createAnswer method generates an [SDP] answer with the supported configuration for the session that is compatible with the parameters in the remote configuration. Like createOffer, the returned blob contains descriptions of the local MediaStreams attached to this RTCPeerConnection, the codec/RTP/RTCP options negotiated for this session, and any candidates that have been gathered by the ICE Agent. The options parameter may be supplied to provide additional control over the generated answer.

    As an answer, the generated SDP will contain a specific configuration that, along with the corresponding offer, specifies how the media plane should be established. The generation of the SDP must follow the appropriate process for generating an answer.

    Session descriptions generated by createAnswer must be immediately usable by setLocalDescription without causing an error as long as setLocalDescription is called reasonably soon. Like createOffer, the returned description should reflect the current state of the system. The session descriptions must remain usable by setLocalDescription without causing an error until at least the end of the fulfillment callback of the returned promise. Calling this method is needed to get the ICE user name fragment and password.

    An answer can be marked as provisional, as described in [RTCWEB-JSEP], by setting the type to "pranswer".

    If the RTCPeerConnection is configured to generate Identity assertions, then the session description shall contain an appropriate assertion.

    If this RTCPeerConnection object is closed before the SDP generation process completes, the USER agent must suppress the result and not resolve or reject the returned promise.

    If the SDP generation process completed successfully, the user agent must resolve the returned promise with a newly created RTCSessionDescription object, representing the generated answer.

    If the SDP generation process failed for any reason, the user agent must reject the returned promise with a DOMError object of type TBD.

  12. def createDTMFSender(track: MediaStreamTrack): RTCDTMFSender

    Permalink

    Creates a new RTCDTMFSender, associated to a specific MediaStreamTrack, that will be able to send DTMF phone signaling over the connection.

    Creates a new RTCDTMFSender, associated to a specific MediaStreamTrack, that will be able to send DTMF phone signaling over the connection.

    MDN

  13. def createDataChannel(label: String, dataChannelDict: RTCDataChannelInit): RTCDataChannel

    Permalink

    Creates a new RTCDataChannel associated with this connection.

    Creates a new RTCDataChannel associated with this connection. The method takes a dictionary as parameter, with the configuration required for the underlying data channel, like its reliability.

    MDN

  14. def createOffer(options: RTCOfferOptions = js.native): Promise[RTCSessionDescription]

    Permalink

    The createOffer method generates a blob of SDP that contains an RFC 3264 offer with the supported configurations for the session, including descriptions of the local MediaStreams attached to this RTCPeerConnection, the codec/RTP/RTCP options supported by this implementation, and any candidates that have been gathered by the ICE Agent.

    The createOffer method generates a blob of SDP that contains an RFC 3264 offer with the supported configurations for the session, including descriptions of the local MediaStreams attached to this RTCPeerConnection, the codec/RTP/RTCP options supported by this implementation, and any candidates that have been gathered by the ICE Agent. The options parameter may be supplied to provide additional control over the offer generated.

    As an offer, the generated SDP will contain the full set of capabilities supported by the session (as opposed to an answer, which will include only a specific negotiated subset to use); for each SDP line, the generation of the SDP must follow the appropriate process for generating an offer. In the event createOffer is called after the session is established, createOffer will generate an offer that is compatible with the current session, incorporating any changes that have been made to the session since the last complete offer-answer exchange, such as addition or removal of streams. If no changes have been made, the offer will include the capabilities of the current local description as well as any additional capabilities that could be negotiated in an updated offer.

    Session descriptions generated by createOffer must be immediately usable by setLocalDescription without causing an error as long as setLocalDescription is called reasonably soon. If a system has limited resources (e.g. a finite number of decoders), createOffer needs to return an offer that reflects the current state of the system, so that setLocalDescription will succeed when it attempts to acquire those resources. The session descriptions must remain usable by setLocalDescription without causing an error until at least the end of the fulfillment callback of the returned promise. Calling this method is needed to get the ICE user name fragment and password.

    If the RTCPeerConnection is configured to generate Identity assertions, then the session description shall contain an appropriate assertion.

    If this RTCPeerConnection object is closed before the SDP generation process completes, the USER agent must suppress the result and not resolve or reject the returned promise.

    If the SDP generation process completed successfully, the user agent must resolve the returned promise with a newly created RTCSessionDescription object, representing the generated offer.

    If the SDP generation process failed for any reason, the user agent must reject the returned promise with an DOMError object of type TBD as its argument.

    To Do: Discuss privacy aspects of this from a fingerprinting point of view - it's probably around as bad as access to a canvas :-)

  15. def dispatchEvent(evt: raw.Event): Boolean

    Permalink

    Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order.

    Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

    MDN

    Definition Classes
    EventTarget
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def getConfiguration(): RTCConfiguration

    Permalink
  21. def getIdentityAssertion(): Promise[Unit]

    Permalink

    Initiates the process of obtaining an identity assertion.

    Initiates the process of obtaining an identity assertion. Applications need not make this call. It is merely intended to allow them to start the process of obtaining identity assertions before a call is initiated. If an identity is needed, either because the browser has been configured with a default identity provider or because the setIdentityProvider() method was called, then an identity will be automatically requested when an offer or answer is created.

    When getIdentityAssertion is invoked, queue a task to run the following steps:

    - If the connection's RTCPeerConnection signalingState is closed, abort these steps.

    - Request an identity assertion from the IdP.

  22. def getLocalStreams(): Array[MediaStream]

    Permalink

    Returns an array of MediaStream associated with the local end of the connection.

    Returns an array of MediaStream associated with the local end of the connection. The array may be empty.

    MDN

  23. def getRemoteStreams(): Array[MediaStream]

    Permalink

    Returns an array of MediaStream associated with the remote end of the connection.

    Returns an array of MediaStream associated with the remote end of the connection. The array may be empty.

    MDN

  24. def getStats(selector: MediaStreamTrack, callback: Function1[RTCStatsReport, Any], error: Function1[raw.DOMError, Any]): RTCStatsReport

    Permalink

    Creates a new RTCStatsReport that contains and allows access to statistics regarding the connection.

    Creates a new RTCStatsReport that contains and allows access to statistics regarding the connection.

    MDN

  25. def getStreamById(id: String): MediaStream

    Permalink

    Returns the MediaStream with the given id that is associated with local or remote end of the connection.

    Returns the MediaStream with the given id that is associated with local or remote end of the connection. If no stream matches, it returns null.

    MDN

  26. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  27. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  28. def iceConnectionState: RTCIceConnectionState

    Permalink

    Returns an enum of type RTCIceConnectionState that describes the ICE connection state for the connection.

    Returns an enum of type RTCIceConnectionState that describes the ICE connection state for the connection. When this value changes, a iceconnectionstatechange event is fired on the object. The possible values are:

    • "new": the ICE agent is gathering addresses or waiting for remote candidates (or both).
    • "checking": the ICE agent has remote candidates, on at least one component, and is check them, though it has not found a connection yet. At the same time, it may still be gathering candidates.
    • "connected": the ICE agent has found a usable connection for each component, but is still testing more remote candidates for a better connection. At the same time, it may still be gathering candidates.
    • "completed": the ICE agent has found a usable connection for each component, and is no more testing remote candidates.
    • "failed": the ICE agent has checked all the remote candidates and didn't find a match for at least one component. Connections may have been found for some components.
    • "disconnected": liveness check has failed for at least one component. This may be a transient state, e. g. on a flaky network, that can recover by itself.
    • "closed": the ICE agent has shutdown and is not answering to requests.

    MDN

  29. def iceGatheringState: RTCIceGatheringState

    Permalink

    Returns an enum of type RTCIceGatheringState that describes the ICE gathering state for the connection.

    Returns an enum of type RTCIceGatheringState that describes the ICE gathering state for the connection. The possible values are:

    • "new": the object was just created, and no networking has occurred yet.
    • "gathering": the ICE engine is in the process of gathering candidates for this connection.
    • "complete": the ICE engine has completed gathering. Events such as adding a new interface or a new TURN server will cause the state to go back to gathering.

    MDN

  30. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  31. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  32. def localDescription: RTCSessionDescription

    Permalink

    Returns a RTCSessionDescription describing the session for the local end of the connection.

    Returns a RTCSessionDescription describing the session for the local end of the connection. If it has not yet been set, it can be null.

    MDN

  33. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  34. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  36. var onaddstream: Function1[MediaStreamEvent, Any]

    Permalink

    Is the event handler called when the addstream event is received.

    Is the event handler called when the addstream event is received. Such an event is sent when a MediaStream is added to this connection by the remote peer. The event is sent immediately after the call RTCPeerConnection.setRemoteDescription() and doesn't wait for the result of the SDP negotiation.

    MDN

  37. var ondatachannel: Function1[RTCDataChannelEvent, Any]

    Permalink

    Is the event handler called when the datachannel event is received.

    Is the event handler called when the datachannel event is received. Such an event is sent when a RTCDataChannel is added to this connection.

    MDN

  38. var onicecandidate: Function1[RTCPeerConnectionIceEvent, Any]

    Permalink

    Is the event handler called when the icecandidate event is received.

    Is the event handler called when the icecandidate event is received. Such an event is sent when a RTCICECandidate object is added to the script.

    MDN

  39. var oniceconnectionstatechange: Function1[raw.Event, Any]

    Permalink

    Is the event handler called when the iceconnectionstatechange event is received.

    Is the event handler called when the iceconnectionstatechange event is received. Such an event is sent when the value of iceConnectionState changes.

    MDN

  40. var onidentityresult: Function1[raw.Event, Any]

    Permalink

    Is the event handler called when the identityresult event is received.

    Is the event handler called when the identityresult event is received. Such an event is sent when an identity assertion is generated, via getIdentityAssertion(), or during the creation of an offer or an answer.

    MDN

  41. var onidpassertionerror: Function1[raw.Event, Any]

    Permalink

    Is the event handler called when the idpassertionerror event is received.

    Is the event handler called when the idpassertionerror event is received. Such an event is sent when the associated identity provider (IdP) encounters an error while generating an identity assertion.

    MDN

  42. var onidpvalidationerror: Function1[raw.Event, Any]

    Permalink

    Is the event handler alled when the idpvalidationerror event is received.

    Is the event handler alled when the idpvalidationerror event is received. Such an event is sent when the associated identity provider (IdP) encounters an error while validating an identity assertion.

    MDN

  43. var onnegotiationneeded: Function1[raw.Event, Any]

    Permalink

    Is the event handler called when the negotiationneeded event, sent by the browser to inform that negotiation will be required at some point in the future, is received.

    Is the event handler called when the negotiationneeded event, sent by the browser to inform that negotiation will be required at some point in the future, is received.

    MDN

  44. var onpeeridentity: Function1[raw.Event, Any]

    Permalink

    Is the event handler called when the peeridentity event, sent when a peer identity has been set and verified on this connection, is received.

    Is the event handler called when the peeridentity event, sent when a peer identity has been set and verified on this connection, is received.

    MDN

  45. var onremovestream: Function1[MediaStreamEvent, Any]

    Permalink

    Is the event handler called when the removestream event, sent when a MediaStream is removed from this connection, is received.

    Is the event handler called when the removestream event, sent when a MediaStream is removed from this connection, is received.

    MDN

  46. var onsignalingstatechange: Function1[raw.Event, Any]

    Permalink

    Is the event handler called when the signalingstatechange event, sent when the value of signalingState changes, is received.

    Is the event handler called when the signalingstatechange event, sent when the value of signalingState changes, is received.

    MDN

  47. val peerIdentity: RTCIdentityAssertion

    Permalink

    Returns a RTCIdentityAssertion, that is a couple of a domain name (idp) and a name (name) representing the identity of the remote peer of this connection, once set and verified.

    Returns a RTCIdentityAssertion, that is a couple of a domain name (idp) and a name (name) representing the identity of the remote peer of this connection, once set and verified. If no peer has yet been set and verified, this property will return null. Once set, via the appropriate method, it can't be changed.

    MDN

  48. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  49. def remoteDescription: RTCSessionDescription

    Permalink

    Returns a RTCSessionDescription describing the session for the remote end of the connection.

    Returns a RTCSessionDescription describing the session for the remote end of the connection. If it has not yet been set, it can be null.

    MDN

  50. def removeEventListener[T <: raw.Event](type: String, listener: Function1[T, _], useCapture: Boolean = js.native): Unit

    Permalink

    Removes the event listener previously registered with EventTarget.addEventListener.

    Removes the event listener previously registered with EventTarget.addEventListener.

    MDN

    Definition Classes
    EventTarget
  51. def removeStream(stream: MediaStream): Unit

    Permalink

    Removes a MediaStream as a local source of audio or video.

    Removes a MediaStream as a local source of audio or video. If the negotiation already happened, a new one will be needed for the remote peer to stop using it.

    MDN

  52. def setIdentityProvider(provider: String, protocol: String = js.native, usernameHint: String = js.native): Unit

    Permalink

    Sets the identity provider to be used for a given RTCPeerConnection object.

    Sets the identity provider to be used for a given RTCPeerConnection object. Applications need not make this call; if the browser is already configured for an IdP, then that configured IdP might be used to get an assertion.

    When the setIdentityProvider() method is invoked, the user agent must run the following steps: - If the connection's RTCPeerConnection signalingState is closed, throw an InvalidStateError exception and abort these steps.

    - Set the current identity provider values to the triplet (provider, protocol, usernameHint).

    - If any identity provider value has changed, discard any stored identity assertion.

    - Identity provider information is not used until an identity assertion is required, either in response to a call to getIdentityAssertion, or a session description is requested with a call to either createOffer or createAnswer.

  53. def setLocalDescription(description: RTCSessionDescription): Promise[Unit]

    Permalink

    Changes the local description associated with the connection.

    Changes the local description associated with the connection. The description defines the properties of the connection like its codec. The connection is affected by this change and must be able to support both old and new descriptions. The method takes one parameters, a RTCSessionDescription object to set, and returns a Promise.

    MDN

  54. def setRemoteDescription(description: RTCSessionDescription): Promise[Unit]

    Permalink

    Changes the remote description associated with the connection.

    Changes the remote description associated with the connection. The description defines the properties of the connection like its codec. The connection is affected by this change and must be able to support both old and new descriptions. The method takes one parameters, a RTCSessionDescription object to set, and returns a Promise.

    MDN

  55. def signalingState: RTCSignalingState

    Permalink

    Returns an enum of type RTCSignalingState that describes the signaling state of the local connection.

    Returns an enum of type RTCSignalingState that describes the signaling state of the local connection. This state describes the SDP offer, that defines the configuration of the connections like the description of the locally associated objects of type MediaStream, the codec/RTP/RTCP options, the candidates gathered by the ICE Agent. When this value changes, a signalingstatechange event is fired on the object. The possible values are:

    • "stable": there is no SDP offer/answer exchange in progress. This is also the initial state of the connection.
    • "have-local-offer": the local end of the connection has locally applied a SDP offer.
    • "have-remote-offer": the remote end of the connection has locally applied a SDP offer.
    • "have-local-pranswer": a remote SDP offer has been applied, and a SDP pranswer applied locally.
    • "have-remote-pranswer": a local SDP offer has been applied, and a SDP pranswer applied remotely.
    • "closed": the connection is closed.

    MDN

  56. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  57. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  58. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  59. def updateIce(configuration: RTCConfiguration): Unit

    Permalink

    The updateIce method updates the ICE Agent process of gathering local candidates and pinging remote candidates.

    The updateIce method updates the ICE Agent process of gathering local candidates and pinging remote candidates. If there is a mandatory constraint called "IceTransports" it will control how the ICE engine can act. This can be used to limit the use to TURN candidates by a callee to avoid leaking location information prior to the call being accepted. This call may result in a change to the state of the ICE Agent, and may result in a change to media state if it results in connectivity being established

    MDN

  60. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  61. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  62. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  63. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from raw.EventTarget

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped