Class

org.scalajs.dom

RTCPeerConnection

Related Doc: package dom

Permalink

class RTCPeerConnection extends 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.

Annotations
@JSType() @native() @JSGlobal()
Linear Supertypes
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 <: Event](type: String, listener: Function1[T, _], options: EventListenerOptions): 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).

    This implementation accepts a settings object of type EventListenerOptions.

    Definition Classes
    EventTarget
  5. def addEventListener[T <: 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).

    Definition Classes
    EventTarget
  6. 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.

  7. 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.

  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. 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.

  10. def clone(): AnyRef

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

    Permalink

    Abruptly closes a connection.

  12. def createAnswer(): Promise[RTCSessionDescription]

    Permalink

    The createAnswer() method on the RTCPeerConnection interface creates an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection.

    The createAnswer() method on the RTCPeerConnection interface creates an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection. The answer contains information about any media already attached to the session, codecs and options supported by the browser, and any ICE candidates already gathered. The answer is delivered to the returned Promise, and should then be sent to the source of the offer to continue the negotiation process.

  13. 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.

  14. 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.

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

    Permalink

    The createOffer() method of the RTCPeerConnection interface initiates the creation of an SDP offer for the purpose of starting a new WebRTC connection to a remote peer.

    The createOffer() method of the RTCPeerConnection interface initiates the creation of an SDP offer for the purpose of starting a new WebRTC connection to a remote peer. The SDP offer includes information about any MediaStreamTracks already attached to the WebRTC session, codec, and options supported by the browser, and any candidates already gathered by the ICE agent, for the purpose of being sent over the signaling channel to a potential peer to request a connection or to update the configuration of an existing connection.

    The return value is a Promise which, when the offer has been created, is resolved with a RTCSessionDescription object containing the newly-created offer.

  16. def dispatchEvent(evt: 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().

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

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

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

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

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

    Permalink
  22. 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.
  23. 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.

  24. 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.

  25. def getStats(selector: MediaStreamTrack, callback: Function1[RTCStatsReport, Any], error: Function1[DOMException, Any]): RTCStatsReport

    Permalink

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

  26. 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.

  27. def hasOwnProperty(v: String): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  29. 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.
  30. 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.
  31. final def isInstanceOf[T0]: Boolean

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

    Permalink
    Definition Classes
    Object
  33. 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.

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

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

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

    Permalink
    Definition Classes
    AnyRef
  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.

  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.

  39. var oniceconnectionstatechange: Function1[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.

  40. var onidentityresult: Function1[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.

  41. var onidpassertionerror: Function1[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.

  42. var onidpvalidationerror: Function1[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.

  43. var onnegotiationneeded: Function1[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.

  44. var onpeeridentity: Function1[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.

  45. var onremovetrack: Function1[MediaStreamTrackEvent, Any]

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

    Permalink

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

  47. var ontrack: Function1[MediaStreamTrackEvent, Any]

    Permalink
  48. 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.

  49. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  50. 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.

  51. def removeEventListener[T <: Event](type: String, listener: Function1[T, _], options: EventListenerOptions): Unit

    Permalink

    Removes the event listener previously registered with EventTarget.addEventListener.

    Removes the event listener previously registered with EventTarget.addEventListener.

    This implementation accepts a settings object of type EventListenerOptions.

    Definition Classes
    EventTarget
  52. def removeEventListener[T <: 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.

    Definition Classes
    EventTarget
  53. 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.

  54. 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.
  55. 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.

  56. 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.

  57. 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.
  58. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  61. 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

  62. def valueOf(): Any

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

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

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

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

Inherited from EventTarget

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped