1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/RTCPeerConnection.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,152 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + * 1.9 + * The origin of this IDL file is 1.10 + * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection 1.11 + */ 1.12 + 1.13 +callback RTCSessionDescriptionCallback = void (mozRTCSessionDescription sdp); 1.14 +callback RTCPeerConnectionErrorCallback = void (DOMString errorInformation); 1.15 +callback VoidFunction = void (); 1.16 +callback RTCStatsCallback = void (RTCStatsReport report); 1.17 + 1.18 +enum RTCSignalingState { 1.19 + "stable", 1.20 + "have-local-offer", 1.21 + "have-remote-offer", 1.22 + "have-local-pranswer", 1.23 + "have-remote-pranswer", 1.24 + "closed" 1.25 +}; 1.26 + 1.27 +enum RTCIceGatheringState { 1.28 + "new", 1.29 + "gathering", 1.30 + "complete" 1.31 +}; 1.32 + 1.33 +enum RTCIceConnectionState { 1.34 + "new", 1.35 + "checking", 1.36 + "connected", 1.37 + "completed", 1.38 + "failed", 1.39 + "disconnected", 1.40 + "closed" 1.41 +}; 1.42 + 1.43 +dictionary RTCDataChannelInit { 1.44 + boolean ordered = true; 1.45 + unsigned short? maxRetransmitTime = null; 1.46 + unsigned short? maxRetransmits = null; 1.47 + DOMString protocol = ""; 1.48 + boolean negotiated = false; // spec currently says 'true'; we disagree 1.49 + unsigned short? id = null; 1.50 + 1.51 + // these are deprecated due to renaming in the spec, but still supported for Fx22 1.52 + boolean outOfOrderAllowed; // now ordered, and the default changes to keep behavior the same 1.53 + unsigned short maxRetransmitNum; // now maxRetransmits 1.54 + boolean preset; // now negotiated 1.55 + unsigned short stream; // now id 1.56 +}; 1.57 + 1.58 +// Misnomer dictionaries housing PeerConnection-specific constraints. 1.59 +// 1.60 +// Important! Do not ever add members that might need tracing (e.g. object) 1.61 +// to MediaConstraintSet or any dictionary marked XxxInternal here 1.62 + 1.63 +dictionary MediaConstraintSet { 1.64 + boolean OfferToReceiveAudio; 1.65 + boolean OfferToReceiveVideo; 1.66 + boolean MozDontOfferDataChannel; 1.67 + boolean MozBundleOnly; 1.68 +}; 1.69 + 1.70 +// MediaConstraint = single-property-subset of MediaConstraintSet 1.71 +// Implemented as full set. Test Object.keys(pair).length == 1 1.72 + 1.73 +// typedef MediaConstraintSet MediaConstraint; // TODO: Bug 913053 1.74 + 1.75 +dictionary MediaConstraints { 1.76 + object mandatory; // so we can see unknown + unsupported constraints 1.77 + sequence<MediaConstraintSet> _optional; // a.k.a. MediaConstraint 1.78 +}; 1.79 + 1.80 +dictionary MediaConstraintsInternal { 1.81 + MediaConstraintSet mandatory; // holds only supported constraints 1.82 + sequence<MediaConstraintSet> _optional; // a.k.a. MediaConstraint 1.83 +}; 1.84 + 1.85 +interface RTCDataChannel; 1.86 + 1.87 +[Pref="media.peerconnection.enabled", 1.88 + JSImplementation="@mozilla.org/dom/peerconnection;1", 1.89 + Constructor (optional RTCConfiguration configuration, 1.90 + optional object? constraints)] 1.91 +// moz-prefixed until sufficiently standardized. 1.92 +interface mozRTCPeerConnection : EventTarget { 1.93 + [Pref="media.peerconnection.identity.enabled"] 1.94 + void setIdentityProvider (DOMString provider, 1.95 + optional DOMString protocol, 1.96 + optional DOMString username); 1.97 + [Pref="media.peerconnection.identity.enabled"] 1.98 + void getIdentityAssertion(); 1.99 + void createOffer (RTCSessionDescriptionCallback successCallback, 1.100 + RTCPeerConnectionErrorCallback failureCallback, 1.101 + optional MediaConstraints constraints); 1.102 + void createAnswer (RTCSessionDescriptionCallback successCallback, 1.103 + RTCPeerConnectionErrorCallback failureCallback, 1.104 + optional MediaConstraints constraints); 1.105 + void setLocalDescription (mozRTCSessionDescription description, 1.106 + optional VoidFunction successCallback, 1.107 + optional RTCPeerConnectionErrorCallback failureCallback); 1.108 + void setRemoteDescription (mozRTCSessionDescription description, 1.109 + optional VoidFunction successCallback, 1.110 + optional RTCPeerConnectionErrorCallback failureCallback); 1.111 + readonly attribute mozRTCSessionDescription? localDescription; 1.112 + readonly attribute mozRTCSessionDescription? remoteDescription; 1.113 + readonly attribute RTCSignalingState signalingState; 1.114 + void updateIce (optional RTCConfiguration configuration, 1.115 + optional MediaConstraints constraints); 1.116 + void addIceCandidate (mozRTCIceCandidate candidate, 1.117 + optional VoidFunction successCallback, 1.118 + optional RTCPeerConnectionErrorCallback failureCallback); 1.119 + readonly attribute RTCIceGatheringState iceGatheringState; 1.120 + readonly attribute RTCIceConnectionState iceConnectionState; 1.121 + [Pref="media.peerconnection.identity.enabled"] 1.122 + readonly attribute RTCIdentityAssertion? peerIdentity; 1.123 + 1.124 + sequence<MediaStream> getLocalStreams (); 1.125 + sequence<MediaStream> getRemoteStreams (); 1.126 + MediaStream? getStreamById (DOMString streamId); 1.127 + void addStream (MediaStream stream, optional MediaConstraints constraints); 1.128 + void removeStream (MediaStream stream); 1.129 + void close (); 1.130 + attribute EventHandler onnegotiationneeded; 1.131 + attribute EventHandler onicecandidate; 1.132 + attribute EventHandler onsignalingstatechange; 1.133 + attribute EventHandler onaddstream; 1.134 + attribute EventHandler onremovestream; 1.135 + attribute EventHandler oniceconnectionstatechange; 1.136 + 1.137 + void getStats (MediaStreamTrack? selector, 1.138 + RTCStatsCallback successCallback, 1.139 + RTCPeerConnectionErrorCallback failureCallback); 1.140 + 1.141 + // Data channel. 1.142 + RTCDataChannel createDataChannel (DOMString label, 1.143 + optional RTCDataChannelInit dataChannelDict); 1.144 + attribute EventHandler ondatachannel; 1.145 + attribute EventHandler onconnection; 1.146 + attribute EventHandler onclosedconnection; 1.147 + [Pref="media.peerconnection.identity.enabled"] 1.148 + attribute EventHandler onidentityresult; 1.149 + [Pref="media.peerconnection.identity.enabled"] 1.150 + attribute EventHandler onpeeridentity; 1.151 + [Pref="media.peerconnection.identity.enabled"] 1.152 + attribute EventHandler onidpassertionerror; 1.153 + [Pref="media.peerconnection.identity.enabled"] 1.154 + attribute EventHandler onidpvalidationerror; 1.155 +};