michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is michael@0: * http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection michael@0: */ michael@0: michael@0: callback RTCSessionDescriptionCallback = void (mozRTCSessionDescription sdp); michael@0: callback RTCPeerConnectionErrorCallback = void (DOMString errorInformation); michael@0: callback VoidFunction = void (); michael@0: callback RTCStatsCallback = void (RTCStatsReport report); michael@0: michael@0: enum RTCSignalingState { michael@0: "stable", michael@0: "have-local-offer", michael@0: "have-remote-offer", michael@0: "have-local-pranswer", michael@0: "have-remote-pranswer", michael@0: "closed" michael@0: }; michael@0: michael@0: enum RTCIceGatheringState { michael@0: "new", michael@0: "gathering", michael@0: "complete" michael@0: }; michael@0: michael@0: enum RTCIceConnectionState { michael@0: "new", michael@0: "checking", michael@0: "connected", michael@0: "completed", michael@0: "failed", michael@0: "disconnected", michael@0: "closed" michael@0: }; michael@0: michael@0: dictionary RTCDataChannelInit { michael@0: boolean ordered = true; michael@0: unsigned short? maxRetransmitTime = null; michael@0: unsigned short? maxRetransmits = null; michael@0: DOMString protocol = ""; michael@0: boolean negotiated = false; // spec currently says 'true'; we disagree michael@0: unsigned short? id = null; michael@0: michael@0: // these are deprecated due to renaming in the spec, but still supported for Fx22 michael@0: boolean outOfOrderAllowed; // now ordered, and the default changes to keep behavior the same michael@0: unsigned short maxRetransmitNum; // now maxRetransmits michael@0: boolean preset; // now negotiated michael@0: unsigned short stream; // now id michael@0: }; michael@0: michael@0: // Misnomer dictionaries housing PeerConnection-specific constraints. michael@0: // michael@0: // Important! Do not ever add members that might need tracing (e.g. object) michael@0: // to MediaConstraintSet or any dictionary marked XxxInternal here michael@0: michael@0: dictionary MediaConstraintSet { michael@0: boolean OfferToReceiveAudio; michael@0: boolean OfferToReceiveVideo; michael@0: boolean MozDontOfferDataChannel; michael@0: boolean MozBundleOnly; michael@0: }; michael@0: michael@0: // MediaConstraint = single-property-subset of MediaConstraintSet michael@0: // Implemented as full set. Test Object.keys(pair).length == 1 michael@0: michael@0: // typedef MediaConstraintSet MediaConstraint; // TODO: Bug 913053 michael@0: michael@0: dictionary MediaConstraints { michael@0: object mandatory; // so we can see unknown + unsupported constraints michael@0: sequence _optional; // a.k.a. MediaConstraint michael@0: }; michael@0: michael@0: dictionary MediaConstraintsInternal { michael@0: MediaConstraintSet mandatory; // holds only supported constraints michael@0: sequence _optional; // a.k.a. MediaConstraint michael@0: }; michael@0: michael@0: interface RTCDataChannel; michael@0: michael@0: [Pref="media.peerconnection.enabled", michael@0: JSImplementation="@mozilla.org/dom/peerconnection;1", michael@0: Constructor (optional RTCConfiguration configuration, michael@0: optional object? constraints)] michael@0: // moz-prefixed until sufficiently standardized. michael@0: interface mozRTCPeerConnection : EventTarget { michael@0: [Pref="media.peerconnection.identity.enabled"] michael@0: void setIdentityProvider (DOMString provider, michael@0: optional DOMString protocol, michael@0: optional DOMString username); michael@0: [Pref="media.peerconnection.identity.enabled"] michael@0: void getIdentityAssertion(); michael@0: void createOffer (RTCSessionDescriptionCallback successCallback, michael@0: RTCPeerConnectionErrorCallback failureCallback, michael@0: optional MediaConstraints constraints); michael@0: void createAnswer (RTCSessionDescriptionCallback successCallback, michael@0: RTCPeerConnectionErrorCallback failureCallback, michael@0: optional MediaConstraints constraints); michael@0: void setLocalDescription (mozRTCSessionDescription description, michael@0: optional VoidFunction successCallback, michael@0: optional RTCPeerConnectionErrorCallback failureCallback); michael@0: void setRemoteDescription (mozRTCSessionDescription description, michael@0: optional VoidFunction successCallback, michael@0: optional RTCPeerConnectionErrorCallback failureCallback); michael@0: readonly attribute mozRTCSessionDescription? localDescription; michael@0: readonly attribute mozRTCSessionDescription? remoteDescription; michael@0: readonly attribute RTCSignalingState signalingState; michael@0: void updateIce (optional RTCConfiguration configuration, michael@0: optional MediaConstraints constraints); michael@0: void addIceCandidate (mozRTCIceCandidate candidate, michael@0: optional VoidFunction successCallback, michael@0: optional RTCPeerConnectionErrorCallback failureCallback); michael@0: readonly attribute RTCIceGatheringState iceGatheringState; michael@0: readonly attribute RTCIceConnectionState iceConnectionState; michael@0: [Pref="media.peerconnection.identity.enabled"] michael@0: readonly attribute RTCIdentityAssertion? peerIdentity; michael@0: michael@0: sequence getLocalStreams (); michael@0: sequence getRemoteStreams (); michael@0: MediaStream? getStreamById (DOMString streamId); michael@0: void addStream (MediaStream stream, optional MediaConstraints constraints); michael@0: void removeStream (MediaStream stream); michael@0: void close (); michael@0: attribute EventHandler onnegotiationneeded; michael@0: attribute EventHandler onicecandidate; michael@0: attribute EventHandler onsignalingstatechange; michael@0: attribute EventHandler onaddstream; michael@0: attribute EventHandler onremovestream; michael@0: attribute EventHandler oniceconnectionstatechange; michael@0: michael@0: void getStats (MediaStreamTrack? selector, michael@0: RTCStatsCallback successCallback, michael@0: RTCPeerConnectionErrorCallback failureCallback); michael@0: michael@0: // Data channel. michael@0: RTCDataChannel createDataChannel (DOMString label, michael@0: optional RTCDataChannelInit dataChannelDict); michael@0: attribute EventHandler ondatachannel; michael@0: attribute EventHandler onconnection; michael@0: attribute EventHandler onclosedconnection; michael@0: [Pref="media.peerconnection.identity.enabled"] michael@0: attribute EventHandler onidentityresult; michael@0: [Pref="media.peerconnection.identity.enabled"] michael@0: attribute EventHandler onpeeridentity; michael@0: [Pref="media.peerconnection.identity.enabled"] michael@0: attribute EventHandler onidpassertionerror; michael@0: [Pref="media.peerconnection.identity.enabled"] michael@0: attribute EventHandler onidpvalidationerror; michael@0: };