Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | * |
michael@0 | 6 | * The origin of this IDL file is |
michael@0 | 7 | * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection |
michael@0 | 8 | */ |
michael@0 | 9 | |
michael@0 | 10 | callback RTCSessionDescriptionCallback = void (mozRTCSessionDescription sdp); |
michael@0 | 11 | callback RTCPeerConnectionErrorCallback = void (DOMString errorInformation); |
michael@0 | 12 | callback VoidFunction = void (); |
michael@0 | 13 | callback RTCStatsCallback = void (RTCStatsReport report); |
michael@0 | 14 | |
michael@0 | 15 | enum RTCSignalingState { |
michael@0 | 16 | "stable", |
michael@0 | 17 | "have-local-offer", |
michael@0 | 18 | "have-remote-offer", |
michael@0 | 19 | "have-local-pranswer", |
michael@0 | 20 | "have-remote-pranswer", |
michael@0 | 21 | "closed" |
michael@0 | 22 | }; |
michael@0 | 23 | |
michael@0 | 24 | enum RTCIceGatheringState { |
michael@0 | 25 | "new", |
michael@0 | 26 | "gathering", |
michael@0 | 27 | "complete" |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | enum RTCIceConnectionState { |
michael@0 | 31 | "new", |
michael@0 | 32 | "checking", |
michael@0 | 33 | "connected", |
michael@0 | 34 | "completed", |
michael@0 | 35 | "failed", |
michael@0 | 36 | "disconnected", |
michael@0 | 37 | "closed" |
michael@0 | 38 | }; |
michael@0 | 39 | |
michael@0 | 40 | dictionary RTCDataChannelInit { |
michael@0 | 41 | boolean ordered = true; |
michael@0 | 42 | unsigned short? maxRetransmitTime = null; |
michael@0 | 43 | unsigned short? maxRetransmits = null; |
michael@0 | 44 | DOMString protocol = ""; |
michael@0 | 45 | boolean negotiated = false; // spec currently says 'true'; we disagree |
michael@0 | 46 | unsigned short? id = null; |
michael@0 | 47 | |
michael@0 | 48 | // these are deprecated due to renaming in the spec, but still supported for Fx22 |
michael@0 | 49 | boolean outOfOrderAllowed; // now ordered, and the default changes to keep behavior the same |
michael@0 | 50 | unsigned short maxRetransmitNum; // now maxRetransmits |
michael@0 | 51 | boolean preset; // now negotiated |
michael@0 | 52 | unsigned short stream; // now id |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | // Misnomer dictionaries housing PeerConnection-specific constraints. |
michael@0 | 56 | // |
michael@0 | 57 | // Important! Do not ever add members that might need tracing (e.g. object) |
michael@0 | 58 | // to MediaConstraintSet or any dictionary marked XxxInternal here |
michael@0 | 59 | |
michael@0 | 60 | dictionary MediaConstraintSet { |
michael@0 | 61 | boolean OfferToReceiveAudio; |
michael@0 | 62 | boolean OfferToReceiveVideo; |
michael@0 | 63 | boolean MozDontOfferDataChannel; |
michael@0 | 64 | boolean MozBundleOnly; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | // MediaConstraint = single-property-subset of MediaConstraintSet |
michael@0 | 68 | // Implemented as full set. Test Object.keys(pair).length == 1 |
michael@0 | 69 | |
michael@0 | 70 | // typedef MediaConstraintSet MediaConstraint; // TODO: Bug 913053 |
michael@0 | 71 | |
michael@0 | 72 | dictionary MediaConstraints { |
michael@0 | 73 | object mandatory; // so we can see unknown + unsupported constraints |
michael@0 | 74 | sequence<MediaConstraintSet> _optional; // a.k.a. MediaConstraint |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | dictionary MediaConstraintsInternal { |
michael@0 | 78 | MediaConstraintSet mandatory; // holds only supported constraints |
michael@0 | 79 | sequence<MediaConstraintSet> _optional; // a.k.a. MediaConstraint |
michael@0 | 80 | }; |
michael@0 | 81 | |
michael@0 | 82 | interface RTCDataChannel; |
michael@0 | 83 | |
michael@0 | 84 | [Pref="media.peerconnection.enabled", |
michael@0 | 85 | JSImplementation="@mozilla.org/dom/peerconnection;1", |
michael@0 | 86 | Constructor (optional RTCConfiguration configuration, |
michael@0 | 87 | optional object? constraints)] |
michael@0 | 88 | // moz-prefixed until sufficiently standardized. |
michael@0 | 89 | interface mozRTCPeerConnection : EventTarget { |
michael@0 | 90 | [Pref="media.peerconnection.identity.enabled"] |
michael@0 | 91 | void setIdentityProvider (DOMString provider, |
michael@0 | 92 | optional DOMString protocol, |
michael@0 | 93 | optional DOMString username); |
michael@0 | 94 | [Pref="media.peerconnection.identity.enabled"] |
michael@0 | 95 | void getIdentityAssertion(); |
michael@0 | 96 | void createOffer (RTCSessionDescriptionCallback successCallback, |
michael@0 | 97 | RTCPeerConnectionErrorCallback failureCallback, |
michael@0 | 98 | optional MediaConstraints constraints); |
michael@0 | 99 | void createAnswer (RTCSessionDescriptionCallback successCallback, |
michael@0 | 100 | RTCPeerConnectionErrorCallback failureCallback, |
michael@0 | 101 | optional MediaConstraints constraints); |
michael@0 | 102 | void setLocalDescription (mozRTCSessionDescription description, |
michael@0 | 103 | optional VoidFunction successCallback, |
michael@0 | 104 | optional RTCPeerConnectionErrorCallback failureCallback); |
michael@0 | 105 | void setRemoteDescription (mozRTCSessionDescription description, |
michael@0 | 106 | optional VoidFunction successCallback, |
michael@0 | 107 | optional RTCPeerConnectionErrorCallback failureCallback); |
michael@0 | 108 | readonly attribute mozRTCSessionDescription? localDescription; |
michael@0 | 109 | readonly attribute mozRTCSessionDescription? remoteDescription; |
michael@0 | 110 | readonly attribute RTCSignalingState signalingState; |
michael@0 | 111 | void updateIce (optional RTCConfiguration configuration, |
michael@0 | 112 | optional MediaConstraints constraints); |
michael@0 | 113 | void addIceCandidate (mozRTCIceCandidate candidate, |
michael@0 | 114 | optional VoidFunction successCallback, |
michael@0 | 115 | optional RTCPeerConnectionErrorCallback failureCallback); |
michael@0 | 116 | readonly attribute RTCIceGatheringState iceGatheringState; |
michael@0 | 117 | readonly attribute RTCIceConnectionState iceConnectionState; |
michael@0 | 118 | [Pref="media.peerconnection.identity.enabled"] |
michael@0 | 119 | readonly attribute RTCIdentityAssertion? peerIdentity; |
michael@0 | 120 | |
michael@0 | 121 | sequence<MediaStream> getLocalStreams (); |
michael@0 | 122 | sequence<MediaStream> getRemoteStreams (); |
michael@0 | 123 | MediaStream? getStreamById (DOMString streamId); |
michael@0 | 124 | void addStream (MediaStream stream, optional MediaConstraints constraints); |
michael@0 | 125 | void removeStream (MediaStream stream); |
michael@0 | 126 | void close (); |
michael@0 | 127 | attribute EventHandler onnegotiationneeded; |
michael@0 | 128 | attribute EventHandler onicecandidate; |
michael@0 | 129 | attribute EventHandler onsignalingstatechange; |
michael@0 | 130 | attribute EventHandler onaddstream; |
michael@0 | 131 | attribute EventHandler onremovestream; |
michael@0 | 132 | attribute EventHandler oniceconnectionstatechange; |
michael@0 | 133 | |
michael@0 | 134 | void getStats (MediaStreamTrack? selector, |
michael@0 | 135 | RTCStatsCallback successCallback, |
michael@0 | 136 | RTCPeerConnectionErrorCallback failureCallback); |
michael@0 | 137 | |
michael@0 | 138 | // Data channel. |
michael@0 | 139 | RTCDataChannel createDataChannel (DOMString label, |
michael@0 | 140 | optional RTCDataChannelInit dataChannelDict); |
michael@0 | 141 | attribute EventHandler ondatachannel; |
michael@0 | 142 | attribute EventHandler onconnection; |
michael@0 | 143 | attribute EventHandler onclosedconnection; |
michael@0 | 144 | [Pref="media.peerconnection.identity.enabled"] |
michael@0 | 145 | attribute EventHandler onidentityresult; |
michael@0 | 146 | [Pref="media.peerconnection.identity.enabled"] |
michael@0 | 147 | attribute EventHandler onpeeridentity; |
michael@0 | 148 | [Pref="media.peerconnection.identity.enabled"] |
michael@0 | 149 | attribute EventHandler onidpassertionerror; |
michael@0 | 150 | [Pref="media.peerconnection.identity.enabled"] |
michael@0 | 151 | attribute EventHandler onidpvalidationerror; |
michael@0 | 152 | }; |