org.scalajs.dom.experimental.webrtc

RTCPeerConnection

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() @JSGlobal()
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
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

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

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def addEventListener[T <: raw.Event](type: String, listener: Function1[T, _], options: EventListenerOptions): Unit

    The EventTarget.

    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.

    MDN

    Definition Classes
    EventTarget
  7. def addEventListener[T <: raw.Event](type: String, listener: Function1[T, _], useCapture: Boolean = js.native): Unit

    The EventTarget.

    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
  8. def addIceCandidate(candidate: RTCIceCandidate): Promise[Unit]

    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

  9. def addStream(stream: MediaStream): Unit

    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

  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. val canTrickleIceCandidates: Any

    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.

  12. def clone(): AnyRef

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

    Abruptly closes a connection.

    Abruptly closes a connection.

    MDN

  14. def createAnswer(): Promise[RTCSessionDescription]

    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.

    MDN

  15. def createDTMFSender(track: MediaStreamTrack): RTCDTMFSender

    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

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

    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

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

    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.

    MDN

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

    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
  19. final def eq(arg0: AnyRef): Boolean

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

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

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

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

  24. def getIdentityAssertion(): Promise[Unit]

    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.

  25. def getLocalStreams(): Array[MediaStream]

    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

  26. def getRemoteStreams(): Array[MediaStream]

    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

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

    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

  28. def getStreamById(id: String): MediaStream

    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

  29. def hasOwnProperty(v: String): Boolean

    Definition Classes
    Object
  30. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  31. def iceConnectionState: RTCIceConnectionState

    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

  32. def iceGatheringState: RTCIceGatheringState

    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

  33. final def isInstanceOf[T0]: Boolean

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

    Definition Classes
    Object
  35. def localDescription: RTCSessionDescription

    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

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

    Definition Classes
    AnyRef
  37. final def notify(): Unit

    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  39. var ondatachannel: Function1[RTCDataChannelEvent, Any]

    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

  40. var onicecandidate: Function1[RTCPeerConnectionIceEvent, Any]

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

  47. var onremovetrack: Function1[MediaStreamTrackEvent, Any]

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

    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

  49. var ontrack: Function1[MediaStreamTrackEvent, Any]

  50. val peerIdentity: RTCIdentityAssertion

    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

  51. def propertyIsEnumerable(v: String): Boolean

    Definition Classes
    Object
  52. def remoteDescription: RTCSessionDescription

    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

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

    Removes the event listener previously registered with EventTarget.

    Removes the event listener previously registered with EventTarget.addEventListener.

    This implementation accepts a settings object of type EventListenerOptions.

    MDN

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

    Removes the event listener previously registered with EventTarget.

    Removes the event listener previously registered with EventTarget.addEventListener.

    MDN

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

    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

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

    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.

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

    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

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

    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

  59. def signalingState: RTCSignalingState

    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

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

    Definition Classes
    AnyRef
  61. def toLocaleString(): String

    Definition Classes
    Object
  62. def toString(): String

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

    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

  64. def valueOf(): Any

    Definition Classes
    Object
  65. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from raw.EventTarget

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped