OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 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 |
31 [ | 63 [ |
32 GarbageCollected, | 64 GarbageCollected, |
33 ActiveDOMObject, | 65 DependentLifetime, |
| 66 // TODO(guidou): There should only be one constructor argument, and it |
| 67 // should be optional. |
34 Constructor(Dictionary rtcConfiguration, optional Dictionary mediaConstraint
s), | 68 Constructor(Dictionary rtcConfiguration, optional Dictionary mediaConstraint
s), |
35 ConstructorCallWith=ExecutionContext, | 69 ConstructorCallWith=ExecutionContext, |
36 NoInterfaceObject, | 70 NoInterfaceObject, |
37 RaisesException=Constructor, | 71 RaisesException=Constructor, |
38 ] interface RTCPeerConnection : EventTarget { | 72 ] interface RTCPeerConnection : EventTarget { |
39 [RaisesException] void createOffer(RTCSessionDescriptionCallback successCall
back, [Default=Undefined] optional RTCErrorCallback failureCallback, optional Di
ctionary rtcOfferOptions); | 73 // Promise<RTCSessionDescription> createOffer(optional RTCOfferOptions optio
ns); |
| 74 // Promise<RTCSessionDescription> createAnswer(optional RTCAnswerOptions opt
ions); |
| 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] Promise<void> addIceCandidate ((RTCIceCandidateInit o
r 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; |
40 | 97 |
41 [RaisesException] void createAnswer(RTCSessionDescriptionCallback successCal
lback, [Default=Undefined] optional RTCErrorCallback failureCallback, optional D
ictionary mediaConstraints); | 98 // https://w3c.github.io/webrtc-pc/#legacy-interface-extensions |
| 99 // These methods return or will be changed to return Promise<void> because |
| 100 // having Promise-based versions requires that all overloads return Promises
. |
| 101 [CallWith=ExecutionContext, RaisesException] void createOffer(RTCSessionDesc
riptionCallback successCallback, RTCPeerConnectionErrorCallback failureCallback,
optional Dictionary rtcOfferOptions); |
| 102 // TODO(guidou): There should be no mediaConstraints argument. |
| 103 [CallWith=ExecutionContext, RaisesException] void createAnswer(RTCSessionDes
criptionCallback successCallback, RTCPeerConnectionErrorCallback failureCallback
, optional Dictionary mediaConstraints); |
| 104 [CallWith=ScriptState] Promise<void> setLocalDescription(RTCSessionDescripti
on description, VoidCallback successCallback, [Default=Undefined] optional RTCPe
erConnectionErrorCallback failureCallback); |
| 105 // TODO(guidou): The failureCallback argument should be non-optional. |
| 106 [CallWith=ScriptState] Promise<void> setRemoteDescription(RTCSessionDescript
ion description, VoidCallback successCallback, [Default=Undefined] optional RTCP
eerConnectionErrorCallback failureCallback); |
| 107 [CallWith=ScriptState] Promise<void> addIceCandidate(RTCIceCandidate candida
te, VoidCallback successCallback, RTCPeerConnectionErrorCallback failureCallback
); |
| 108 // TODO(guidou): The selector argument should the first (nullable, |
| 109 // non-optional) argument, and there should be a third failureCallback |
| 110 // argument. |
| 111 [CallWith=ExecutionContext, LegacyInterfaceTypeChecking] void getStats(RTCSt
atsCallback successCallback, [Default=Undefined] optional MediaStreamTrack selec
tor); |
42 | 112 |
43 [RaisesException] void setLocalDescription(RTCSessionDescription description
, [Default=Undefined] optional VoidCallback successCallback, [Default=Undefined]
optional RTCErrorCallback failureCallback); | 113 // https://w3c.github.io/webrtc-pc/#peer-to-peer-data-api |
44 [RaisesException=Getter] readonly attribute RTCSessionDescription localDescr
iption; | 114 // TODO(guidou): The label argument should have [TreatNullAs=EmptyString] |
| 115 // and be non-nullable. |
| 116 [RaisesException] RTCDataChannel createDataChannel([TreatUndefinedAs=NullStr
ing] DOMString? label, optional Dictionary options); |
| 117 attribute EventHandler ondatachannel; |
45 | 118 |
46 [RaisesException] void setRemoteDescription(RTCSessionDescription descriptio
n, [Default=Undefined] optional VoidCallback successCallback, [Default=Undefined
] optional RTCErrorCallback failureCallback); | 119 // Non-standard or removed from the spec: |
47 [RaisesException=Getter] readonly attribute RTCSessionDescription remoteDesc
ription; | 120 [CallWith=ExecutionContext, RaisesException] void updateIce(optional Diction
ary configuration, optional Dictionary mediaConstraints); |
48 | |
49 readonly attribute DOMString signalingState; | |
50 | |
51 [RaisesException] void updateIce(optional Dictionary configuration, optional
Dictionary mediaConstraints); | |
52 | |
53 // DEPRECATED | |
54 [RaisesException] void addIceCandidate(RTCIceCandidate candidate); | |
55 | |
56 [RaisesException] void addIceCandidate(RTCIceCandidate candidate, VoidCallba
ck successCallback, RTCErrorCallback failureCallback); | |
57 | |
58 readonly attribute DOMString iceGatheringState; | |
59 readonly attribute DOMString iceConnectionState; | |
60 | |
61 sequence<MediaStream> getLocalStreams(); | 121 sequence<MediaStream> getLocalStreams(); |
62 sequence<MediaStream> getRemoteStreams(); | 122 sequence<MediaStream> getRemoteStreams(); |
63 MediaStream getStreamById(DOMString streamId); | 123 MediaStream getStreamById(DOMString streamId); |
64 | 124 [CallWith=ExecutionContext, RaisesException] void addStream(MediaStream? str
eam, optional Dictionary mediaConstraints); |
65 [TypeChecking=Interface, RaisesException] void addStream(MediaStream? stream
, optional Dictionary mediaConstraints); | 125 [RaisesException] void removeStream(MediaStream? stream); |
66 [TypeChecking=Interface, RaisesException] void removeStream(MediaStream? str
eam); | |
67 | |
68 void getStats(RTCStatsCallback successCallback, [Default=Undefined] optional
MediaStreamTrack selector); | |
69 | |
70 [RaisesException] RTCDataChannel createDataChannel([TreatUndefinedAs=NullStr
ing] DOMString? label, optional Dictionary options); | |
71 | |
72 [RaisesException] RTCDTMFSender createDTMFSender(MediaStreamTrack track); | 126 [RaisesException] RTCDTMFSender createDTMFSender(MediaStreamTrack track); |
73 | |
74 [RaisesException] void close(); | |
75 | |
76 attribute EventHandler onnegotiationneeded; | |
77 attribute EventHandler onicecandidate; | |
78 attribute EventHandler onsignalingstatechange; | |
79 attribute EventHandler onaddstream; | 127 attribute EventHandler onaddstream; |
80 attribute EventHandler onremovestream; | 128 attribute EventHandler onremovestream; |
81 attribute EventHandler oniceconnectionstatechange; | 129 |
82 attribute EventHandler ondatachannel; | 130 // Certificate management |
| 131 // http://w3c.github.io/webrtc-pc/#sec.cert-mgmt |
| 132 [RaisesException, CallWith=ScriptState] static Promise<RTCCertificate> gener
ateCertificate(AlgorithmIdentifier keygenAlgorithm); |
83 }; | 133 }; |
OLD | NEW |