tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RTCPeerConnection.webidl (7749B)


      1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      4 * You can obtain one at http://mozilla.org/MPL/2.0/.
      5 *
      6 * The origin of this IDL file is
      7 * http://w3c.github.io/webrtc-pc/#interface-definition
      8 */
      9 
     10 callback RTCSessionDescriptionCallback = undefined (RTCSessionDescriptionInit description);
     11 callback RTCPeerConnectionErrorCallback = undefined (DOMException error);
     12 callback RTCStatsCallback = undefined (RTCStatsReport report);
     13 
     14 enum RTCSignalingState {
     15    "stable",
     16    "have-local-offer",
     17    "have-remote-offer",
     18    "have-local-pranswer",
     19    "have-remote-pranswer",
     20    "closed"
     21 };
     22 
     23 enum RTCIceGatheringState {
     24    "new",
     25    "gathering",
     26    "complete"
     27 };
     28 
     29 enum RTCIceConnectionState {
     30  "closed",
     31  "failed",
     32  "disconnected",
     33  "new",
     34  "checking",
     35  "completed",
     36  "connected"
     37 };
     38 
     39 enum RTCPeerConnectionState {
     40  "closed",
     41  "failed",
     42  "disconnected",
     43  "new",
     44  "connecting",
     45  "connected"
     46 };
     47 
     48 enum mozPacketDumpType {
     49  "rtp", // dump unencrypted rtp as the MediaPipeline sees it
     50  "srtp", // dump encrypted rtp as the MediaPipeline sees it
     51  "rtcp", // dump unencrypted rtcp as the MediaPipeline sees it
     52  "srtcp" // dump encrypted rtcp as the MediaPipeline sees it
     53 };
     54 
     55 callback mozPacketCallback = undefined (unsigned long level,
     56                                        mozPacketDumpType type,
     57                                        boolean sending,
     58                                        ArrayBuffer packet);
     59 
     60 dictionary RTCDataChannelInit {
     61  boolean        ordered = true;
     62  [EnforceRange]
     63  unsigned short maxPacketLifeTime;
     64  [EnforceRange]
     65  unsigned short maxRetransmits;
     66  UTF8String     protocol = "";
     67  boolean        negotiated = false;
     68  [EnforceRange]
     69  unsigned short id;
     70 };
     71 
     72 dictionary RTCOfferAnswerOptions {
     73 //  boolean voiceActivityDetection = true; // TODO: support this (Bug 1184712)
     74 };
     75 
     76 dictionary RTCAnswerOptions : RTCOfferAnswerOptions {
     77 };
     78 
     79 dictionary RTCOfferOptions : RTCOfferAnswerOptions {
     80  boolean offerToReceiveVideo;
     81  boolean offerToReceiveAudio;
     82  boolean iceRestart = false;
     83 };
     84 
     85 [Pref="media.peerconnection.enabled",
     86 JSImplementation="@mozilla.org/dom/peerconnection;1",
     87 Exposed=Window]
     88 interface RTCPeerConnection : EventTarget  {
     89  [Throws]
     90  constructor(optional RTCConfiguration configuration = {});
     91 
     92  [Throws, StaticClassOverride="mozilla::dom::RTCCertificate"]
     93  static Promise<RTCCertificate> generateCertificate (AlgorithmIdentifier keygenAlgorithm);
     94 
     95  undefined setIdentityProvider (DOMString provider,
     96                                 optional RTCIdentityProviderOptions options = {});
     97  Promise<DOMString> getIdentityAssertion();
     98  Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {});
     99  Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {});
    100  Promise<undefined> setLocalDescription(optional RTCLocalSessionDescriptionInit description = {});
    101  readonly attribute RTCSessionDescription? localDescription;
    102  readonly attribute RTCSessionDescription? currentLocalDescription;
    103  readonly attribute RTCSessionDescription? pendingLocalDescription;
    104  Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description);
    105  readonly attribute RTCSessionDescription? remoteDescription;
    106  readonly attribute RTCSessionDescription? currentRemoteDescription;
    107  readonly attribute RTCSessionDescription? pendingRemoteDescription;
    108  readonly attribute RTCSignalingState signalingState;
    109  Promise<undefined> addIceCandidate (optional (RTCIceCandidateInit or RTCIceCandidate) candidate = {});
    110  readonly attribute boolean? canTrickleIceCandidates;
    111  readonly attribute RTCIceGatheringState iceGatheringState;
    112  readonly attribute RTCIceConnectionState iceConnectionState;
    113  readonly attribute RTCPeerConnectionState connectionState;
    114  undefined restartIce ();
    115  readonly attribute Promise<RTCIdentityAssertion> peerIdentity;
    116  readonly attribute DOMString? idpLoginUrl;
    117 
    118  [ChromeOnly]
    119  attribute DOMString id;
    120 
    121  RTCConfiguration      getConfiguration ();
    122  undefined setConfiguration(optional RTCConfiguration configuration = {});
    123  [Deprecated="RTCPeerConnectionGetStreams"]
    124  sequence<MediaStream> getLocalStreams ();
    125  [Deprecated="RTCPeerConnectionGetStreams"]
    126  sequence<MediaStream> getRemoteStreams ();
    127  undefined addStream (MediaStream stream);
    128 
    129  // replaces addStream; fails if already added
    130  // because a track can be part of multiple streams, stream parameters
    131  // indicate which particular streams should be referenced in signaling
    132 
    133  RTCRtpSender addTrack(MediaStreamTrack track,
    134                        MediaStream... streams);
    135  undefined removeTrack(RTCRtpSender sender);
    136 
    137  [Throws]
    138  RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
    139                                   optional RTCRtpTransceiverInit init = {});
    140 
    141  sequence<RTCRtpSender> getSenders();
    142  sequence<RTCRtpReceiver> getReceivers();
    143  sequence<RTCRtpTransceiver> getTransceivers();
    144 
    145  [ChromeOnly]
    146  undefined mozSetPacketCallback(mozPacketCallback callback);
    147  [ChromeOnly]
    148  undefined mozEnablePacketDump(unsigned long level,
    149                                mozPacketDumpType type,
    150                                boolean sending);
    151  [ChromeOnly]
    152  undefined mozDisablePacketDump(unsigned long level,
    153                                 mozPacketDumpType type,
    154                                 boolean sending);
    155 
    156  undefined close ();
    157  attribute EventHandler onnegotiationneeded;
    158  attribute EventHandler onicecandidate;
    159  attribute EventHandler onsignalingstatechange;
    160  attribute EventHandler onaddstream; // obsolete
    161  attribute EventHandler onaddtrack;  // obsolete
    162  attribute EventHandler ontrack;     // replaces onaddtrack and onaddstream.
    163  attribute EventHandler oniceconnectionstatechange;
    164  attribute EventHandler onicegatheringstatechange;
    165  attribute EventHandler onconnectionstatechange;
    166 
    167  Promise<RTCStatsReport> getStats (optional MediaStreamTrack? selector = null);
    168 
    169  readonly attribute RTCSctpTransport? sctp;
    170  // Data channel.
    171  RTCDataChannel createDataChannel (UTF8String label,
    172                                    optional RTCDataChannelInit dataChannelDict = {});
    173  attribute EventHandler ondatachannel;
    174 };
    175 
    176 // Legacy callback API
    177 
    178 partial interface RTCPeerConnection {
    179 
    180  // Legacy Interface Extensions
    181  // Supporting the methods in this section is optional.
    182  // If these methods are supported
    183  // they must be implemented as defined
    184  // in section "Legacy Interface Extensions"
    185  Promise<undefined> createOffer(RTCSessionDescriptionCallback successCallback,
    186                                 RTCPeerConnectionErrorCallback failureCallback,
    187                                 optional RTCOfferOptions options = {});
    188  Promise<undefined> setLocalDescription(RTCLocalSessionDescriptionInit description,
    189                                         VoidFunction successCallback,
    190                                         RTCPeerConnectionErrorCallback failureCallback);
    191  Promise<undefined> createAnswer(RTCSessionDescriptionCallback successCallback,
    192                                  RTCPeerConnectionErrorCallback failureCallback);
    193  Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description,
    194                                          VoidFunction successCallback,
    195                                          RTCPeerConnectionErrorCallback failureCallback);
    196  Promise<undefined> addIceCandidate(RTCIceCandidateInit candidate,
    197                                     VoidFunction successCallback,
    198                                     RTCPeerConnectionErrorCallback failureCallback);
    199 };