| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * | |
| 8 * 1. Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 * notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * 3. Neither the name of Google Inc. nor the names of its contributors | |
| 15 * may be used to endorse or promote products derived from this | |
| 16 * software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 // https://w3c.github.io/webrtc-pc/#state-definitions | |
| 32 | |
| 33 enum RTCSignalingState { | |
| 34 "stable", | |
| 35 "have-local-offer", | |
| 36 "have-remote-offer", | |
| 37 "have-local-pranswer", | |
| 38 "have-remote-pranswer", | |
| 39 "closed" | |
| 40 }; | |
| 41 | |
| 42 enum RTCIceGatheringState { | |
| 43 "new", | |
| 44 "gathering", | |
| 45 "complete" | |
| 46 }; | |
| 47 | |
| 48 enum RTCIceConnectionState { | |
| 49 "new", | |
| 50 "checking", | |
| 51 "connected", | |
| 52 "completed", | |
| 53 "failed", | |
| 54 "disconnected", | |
| 55 "closed" | |
| 56 }; | |
| 57 | |
| 58 // https://w3c.github.io/webrtc-pc/#interface-definition | |
| 59 | |
| 60 // TODO(guidou): Many types are of the wrong type in this interface: | |
| 61 // * Dictionary -> specific dictionary types like RTCConfiguration | |
| 62 // * VoidCallback -> VoidFunction | |
| 63 [ | |
| 64 ActiveScriptWrappable, | |
| 65 DependentLifetime, | |
| 66 // TODO(guidou): There should only be one constructor argument, and it | |
| 67 // should be optional. | |
| 68 Constructor(Dictionary rtcConfiguration, optional Dictionary mediaConstraint
s), | |
| 69 ConstructorCallWith=ExecutionContext, | |
| 70 NoInterfaceObject, | |
| 71 RaisesException=Constructor, | |
| 72 ] interface RTCPeerConnection : EventTarget { | |
| 73 [CallWith=ScriptState] Promise<RTCSessionDescription> createOffer(optional R
TCOfferOptions options); | |
| 74 [CallWith=ScriptState] Promise<RTCSessionDescription> createAnswer(optional
RTCAnswerOptions options); | |
| 75 [CallWith=ScriptState] Promise<void> setLocalDescription(RTCSessionDescripti
onInit description); | |
| 76 readonly attribute RTCSessionDescription? localDescription; | |
| 77 // readonly attribute RTCSessionDescription? currentLocalDescription; | |
| 78 // readonly attribute RTCSessionDescription? pendingLocalDescription; | |
| 79 [CallWith=ScriptState] Promise<void> setRemoteDescription(RTCSessionDescript
ionInit description); | |
| 80 readonly attribute RTCSessionDescription? remoteDescription; | |
| 81 // readonly attribute RTCSessionDescription? currentRemoteDescription; | |
| 82 // readonly attribute RTCSessionDescription? pendingRemoteDescription; | |
| 83 [CallWith=ScriptState, MeasureAs=RTCPeerConnectionAddIceCandidatePromise] Pr
omise<void> addIceCandidate ((RTCIceCandidateInit or RTCIceCandidate) candidate)
; | |
| 84 readonly attribute RTCSignalingState signalingState; | |
| 85 readonly attribute RTCIceGatheringState iceGatheringState; | |
| 86 readonly attribute RTCIceConnectionState iceConnectionState; | |
| 87 // readonly attribute boolean? canTrickleIceCandidates; | |
| 88 // RTCConfiguration getConfiguration(); | |
| 89 // void setConfiguration(RTCConfiguration configuration); | |
| 90 // TODO(guidou): close() should never throw an exception. | |
| 91 [RaisesException] void close(); | |
| 92 attribute EventHandler onnegotiationneeded; | |
| 93 attribute EventHandler onicecandidate; | |
| 94 attribute EventHandler onsignalingstatechange; | |
| 95 attribute EventHandler oniceconnectionstatechange; | |
| 96 // attribute EventHandler onicegatheringstatechange; | |
| 97 | |
| 98 // https://w3c.github.io/webrtc-pc/#legacy-interface-extensions | |
| 99 // These methods return Promise<void> because having Promise-based versions
requires that all overloads return Promises. | |
| 100 [CallWith=ScriptState] Promise<void> createOffer(RTCSessionDescriptionCallba
ck successCallback, RTCPeerConnectionErrorCallback failureCallback, optional Dic
tionary rtcOfferOptions); | |
| 101 // TODO(guidou): There should be no mediaConstraints argument. | |
| 102 [CallWith=ScriptState] Promise<void> createAnswer(RTCSessionDescriptionCallb
ack successCallback, RTCPeerConnectionErrorCallback failureCallback, optional Di
ctionary mediaConstraints); | |
| 103 [CallWith=ScriptState] Promise<void> setLocalDescription(RTCSessionDescripti
onInit description, VoidCallback successCallback, [Default=Undefined] optional R
TCPeerConnectionErrorCallback failureCallback); | |
| 104 // TODO(guidou): The failureCallback argument should be non-optional. | |
| 105 [CallWith=ScriptState] Promise<void> setRemoteDescription(RTCSessionDescript
ionInit description, VoidCallback successCallback, [Default=Undefined] optional
RTCPeerConnectionErrorCallback failureCallback); | |
| 106 [CallWith=ScriptState, MeasureAs=RTCPeerConnectionAddIceCandidateLegacy] Pro
mise<void> addIceCandidate((RTCIceCandidateInit or RTCIceCandidate) candidate, V
oidCallback successCallback, RTCPeerConnectionErrorCallback failureCallback); | |
| 107 // TODO(guidou): The selector argument should the first (nullable, | |
| 108 // non-optional) argument, and there should be a third failureCallback | |
| 109 // argument. | |
| 110 [CallWith=ExecutionContext, LegacyInterfaceTypeChecking] void getStats(RTCSt
atsCallback successCallback, [Default=Undefined] optional MediaStreamTrack selec
tor); | |
| 111 | |
| 112 // https://w3c.github.io/webrtc-pc/#peer-to-peer-data-api | |
| 113 // TODO(guidou): The label argument should have [TreatNullAs=EmptyString] | |
| 114 // and be non-nullable. | |
| 115 [RaisesException] RTCDataChannel createDataChannel([TreatUndefinedAs=NullStr
ing] DOMString? label, optional Dictionary options); | |
| 116 attribute EventHandler ondatachannel; | |
| 117 | |
| 118 // Non-standard or removed from the spec: | |
| 119 [CallWith=ExecutionContext, RaisesException] void updateIce(optional Diction
ary configuration, optional Dictionary mediaConstraints); | |
| 120 sequence<MediaStream> getLocalStreams(); | |
| 121 sequence<MediaStream> getRemoteStreams(); | |
| 122 MediaStream getStreamById(DOMString streamId); | |
| 123 [CallWith=ExecutionContext, RaisesException] void addStream(MediaStream? str
eam, optional Dictionary mediaConstraints); | |
| 124 [RaisesException] void removeStream(MediaStream? stream); | |
| 125 [RaisesException] RTCDTMFSender createDTMFSender(MediaStreamTrack track); | |
| 126 attribute EventHandler onaddstream; | |
| 127 attribute EventHandler onremovestream; | |
| 128 | |
| 129 // Certificate management | |
| 130 // http://w3c.github.io/webrtc-pc/#sec.cert-mgmt | |
| 131 [RaisesException, CallWith=ScriptState] static Promise<RTCCertificate> gener
ateCertificate(AlgorithmIdentifier keygenAlgorithm); | |
| 132 }; | |
| OLD | NEW |