PeerConnectionImpl.webidl (4661B)
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 * PeerConnection.js' interface to the C++ PeerConnectionImpl. 7 * 8 * Do not confuse with RTCPeerConnection. This interface is purely for 9 * communication between the PeerConnection JS DOM binding and the C++ 10 * implementation. 11 * 12 * See media/webrtc/signaling/include/PeerConnectionImpl.h 13 * 14 */ 15 16 interface nsISupports; 17 18 callback ChainedOperation = Promise<any> (); 19 20 /* Must be created first. Observer events will be dispatched on the thread provided */ 21 [ChromeOnly, 22 Exposed=Window] 23 interface PeerConnectionImpl { 24 constructor(); 25 26 /* Must be called first. Observer events dispatched on the thread provided */ 27 [Throws] 28 undefined initialize(PeerConnectionObserver observer, Window window); 29 30 /* JSEP calls */ 31 [Throws] 32 undefined createOffer(optional RTCOfferOptions options = {}); 33 [Throws] 34 undefined createAnswer(); 35 [Throws] 36 undefined setLocalDescription(long action, DOMString sdp); 37 [Throws] 38 undefined setRemoteDescription(long action, DOMString sdp); 39 40 Promise<RTCStatsReport> getStats(MediaStreamTrack? selector); 41 42 sequence<MediaStream> getRemoteStreams(); 43 44 /* Adds the tracks created by GetUserMedia */ 45 [Throws] 46 RTCRtpTransceiver addTransceiver(RTCRtpTransceiverInit init, 47 DOMString kind, 48 MediaStreamTrack? sendTrack, 49 boolean addTrackMagic); 50 sequence<RTCRtpTransceiver> getTransceivers(); 51 52 [Throws] 53 undefined closeStreams(); 54 55 [Throws] 56 undefined enablePacketDump(unsigned long level, 57 mozPacketDumpType type, 58 boolean sending); 59 60 [Throws] 61 undefined disablePacketDump(unsigned long level, 62 mozPacketDumpType type, 63 boolean sending); 64 65 /* As the ICE candidates roll in this one should be called each time 66 * in order to keep the candidate list up-to-date for the next SDP-related 67 * call PeerConnectionImpl does not parse ICE candidates, just sticks them 68 * into the SDP. 69 */ 70 [Throws] 71 undefined addIceCandidate(DOMString candidate, 72 DOMString mid, 73 DOMString ufrag, 74 unsigned short? level); 75 76 /* Shuts down threads, deletes state */ 77 [Throws] 78 undefined close(); 79 80 [Throws] 81 undefined setConfiguration(optional RTCConfiguration config = {}); 82 83 undefined restartIce(); 84 undefined restartIceNoRenegotiationNeeded(); 85 86 /* Notify DOM window if this plugin crash is ours. */ 87 boolean pluginCrash(unsigned long long pluginId, DOMString name); 88 89 // Only throws if promise creation fails 90 [Throws] 91 Promise<undefined> onSetDescriptionSuccess(RTCSdpType type, boolean remote); 92 93 undefined onSetDescriptionError(); 94 95 /* Attributes */ 96 /* This provides the implementation with the certificate it uses to 97 * authenticate itself. The JS side must set this before calling 98 * createOffer/createAnswer or retrieving the value of fingerprint. This has 99 * to be delayed because generating the certificate takes some time. */ 100 attribute RTCCertificate certificate; 101 [Constant] 102 readonly attribute DOMString fingerprint; 103 readonly attribute DOMString currentLocalDescription; 104 readonly attribute DOMString pendingLocalDescription; 105 readonly attribute DOMString currentRemoteDescription; 106 readonly attribute DOMString pendingRemoteDescription; 107 readonly attribute boolean? currentOfferer; 108 readonly attribute boolean? pendingOfferer; 109 110 readonly attribute RTCIceConnectionState iceConnectionState; 111 readonly attribute RTCIceGatheringState iceGatheringState; 112 readonly attribute RTCPeerConnectionState connectionState; 113 readonly attribute RTCSignalingState signalingState; 114 attribute DOMString id; 115 116 [SetterThrows] 117 attribute DOMString peerIdentity; 118 readonly attribute boolean privacyRequested; 119 120 readonly attribute boolean duplicateFingerprintQuirk; 121 122 readonly attribute RTCSctpTransport? sctp; 123 124 /* Data channels */ 125 [Throws] 126 RTCDataChannel createDataChannel(UTF8String label, UTF8String protocol, 127 unsigned short type, boolean ordered, 128 unsigned short maxTime, unsigned short maxNum, 129 boolean externalNegotiated, unsigned short stream); 130 131 [Throws] 132 Promise<any> chain(ChainedOperation op); 133 undefined updateNegotiationNeeded(); 134 135 boolean createdSender(RTCRtpSender sender); 136 };