2013-05-07 17:55:21 -07:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection
|
|
|
|
*/
|
|
|
|
|
|
|
|
callback RTCSessionDescriptionCallback = void (mozRTCSessionDescription sdp);
|
2014-11-26 12:26:37 -08:00
|
|
|
callback RTCPeerConnectionErrorCallback = void (DOMError error);
|
2013-05-07 17:55:21 -07:00
|
|
|
callback VoidFunction = void ();
|
2013-10-17 15:00:05 -07:00
|
|
|
callback RTCStatsCallback = void (RTCStatsReport report);
|
2013-05-07 17:55:21 -07:00
|
|
|
|
|
|
|
enum RTCSignalingState {
|
|
|
|
"stable",
|
|
|
|
"have-local-offer",
|
|
|
|
"have-remote-offer",
|
|
|
|
"have-local-pranswer",
|
|
|
|
"have-remote-pranswer",
|
|
|
|
"closed"
|
|
|
|
};
|
|
|
|
|
|
|
|
enum RTCIceGatheringState {
|
|
|
|
"new",
|
|
|
|
"gathering",
|
|
|
|
"complete"
|
|
|
|
};
|
|
|
|
|
|
|
|
enum RTCIceConnectionState {
|
|
|
|
"new",
|
|
|
|
"checking",
|
|
|
|
"connected",
|
|
|
|
"completed",
|
|
|
|
"failed",
|
|
|
|
"disconnected",
|
|
|
|
"closed"
|
|
|
|
};
|
|
|
|
|
2013-05-16 16:40:23 -07:00
|
|
|
dictionary RTCDataChannelInit {
|
2013-06-03 14:34:42 -07:00
|
|
|
boolean ordered = true;
|
|
|
|
unsigned short? maxRetransmitTime = null;
|
|
|
|
unsigned short? maxRetransmits = null;
|
|
|
|
DOMString protocol = "";
|
|
|
|
boolean negotiated = false; // spec currently says 'true'; we disagree
|
|
|
|
unsigned short? id = null;
|
|
|
|
|
|
|
|
// these are deprecated due to renaming in the spec, but still supported for Fx22
|
|
|
|
boolean outOfOrderAllowed; // now ordered, and the default changes to keep behavior the same
|
|
|
|
unsigned short maxRetransmitNum; // now maxRetransmits
|
|
|
|
boolean preset; // now negotiated
|
|
|
|
unsigned short stream; // now id
|
2013-05-16 16:40:23 -07:00
|
|
|
};
|
|
|
|
|
2014-07-10 11:31:25 -07:00
|
|
|
dictionary RTCOfferOptions {
|
|
|
|
long offerToReceiveVideo;
|
|
|
|
long offerToReceiveAudio;
|
2014-09-08 22:12:24 -07:00
|
|
|
boolean mozDontOfferDataChannel;
|
|
|
|
boolean mozBundleOnly;
|
|
|
|
|
|
|
|
// TODO: Remove old constraint-like RTCOptions support soon (Bug 1064223).
|
|
|
|
DeprecatedRTCOfferOptionsSet mandatory;
|
|
|
|
sequence<DeprecatedRTCOfferOptionsSet> _optional;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary DeprecatedRTCOfferOptionsSet {
|
|
|
|
boolean OfferToReceiveAudio; // Note the uppercase 'O'
|
|
|
|
boolean OfferToReceiveVideo; // Note the uppercase 'O'
|
|
|
|
boolean MozDontOfferDataChannel; // Note the uppercase 'M'
|
|
|
|
boolean MozBundleOnly; // Note the uppercase 'M'
|
2013-10-09 19:27:54 -07:00
|
|
|
};
|
|
|
|
|
2013-05-16 16:40:23 -07:00
|
|
|
interface RTCDataChannel;
|
|
|
|
|
2013-05-07 17:55:21 -07:00
|
|
|
[Pref="media.peerconnection.enabled",
|
|
|
|
JSImplementation="@mozilla.org/dom/peerconnection;1",
|
|
|
|
Constructor (optional RTCConfiguration configuration,
|
|
|
|
optional object? constraints)]
|
|
|
|
// moz-prefixed until sufficiently standardized.
|
|
|
|
interface mozRTCPeerConnection : EventTarget {
|
2014-02-10 14:41:46 -08:00
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
void setIdentityProvider (DOMString provider,
|
|
|
|
optional DOMString protocol,
|
|
|
|
optional DOMString username);
|
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
2014-04-08 05:26:00 -07:00
|
|
|
void getIdentityAssertion();
|
2014-12-08 07:36:18 -08:00
|
|
|
Promise<mozRTCSessionDescription> createOffer (optional RTCOfferOptions options);
|
|
|
|
Promise<mozRTCSessionDescription> createAnswer ();
|
|
|
|
Promise<void> setLocalDescription (mozRTCSessionDescription description);
|
|
|
|
Promise<void> setRemoteDescription (mozRTCSessionDescription description);
|
2013-05-16 16:40:23 -07:00
|
|
|
readonly attribute mozRTCSessionDescription? localDescription;
|
|
|
|
readonly attribute mozRTCSessionDescription? remoteDescription;
|
2013-05-07 17:55:21 -07:00
|
|
|
readonly attribute RTCSignalingState signalingState;
|
2014-07-10 11:31:25 -07:00
|
|
|
void updateIce (optional RTCConfiguration configuration);
|
2014-12-08 07:36:18 -08:00
|
|
|
Promise<void> addIceCandidate (mozRTCIceCandidate candidate);
|
2013-05-07 17:55:21 -07:00
|
|
|
readonly attribute RTCIceGatheringState iceGatheringState;
|
|
|
|
readonly attribute RTCIceConnectionState iceConnectionState;
|
2014-02-10 14:41:46 -08:00
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
readonly attribute RTCIdentityAssertion? peerIdentity;
|
|
|
|
|
2014-05-22 14:14:56 -07:00
|
|
|
[ChromeOnly]
|
2014-11-20 11:43:02 -08:00
|
|
|
attribute DOMString id;
|
2014-05-22 14:14:56 -07:00
|
|
|
|
2014-07-10 11:31:25 -07:00
|
|
|
RTCConfiguration getConfiguration ();
|
2013-05-07 17:55:21 -07:00
|
|
|
sequence<MediaStream> getLocalStreams ();
|
|
|
|
sequence<MediaStream> getRemoteStreams ();
|
|
|
|
MediaStream? getStreamById (DOMString streamId);
|
2014-07-10 11:31:25 -07:00
|
|
|
void addStream (MediaStream stream);
|
2013-05-07 17:55:21 -07:00
|
|
|
void removeStream (MediaStream stream);
|
2014-08-13 18:40:41 -07:00
|
|
|
|
|
|
|
// replaces addStream; fails if already added
|
2014-08-13 18:40:54 -07:00
|
|
|
// because a track can be part of multiple streams, stream parameters
|
|
|
|
// indicate which particular streams should be referenced in signaling
|
2014-08-13 18:40:41 -07:00
|
|
|
|
2014-08-13 18:40:54 -07:00
|
|
|
RTCRtpSender addTrack(MediaStreamTrack track,
|
|
|
|
MediaStream stream,
|
|
|
|
MediaStream... moreStreams);
|
2014-08-13 18:40:41 -07:00
|
|
|
void removeTrack(RTCRtpSender sender);
|
|
|
|
|
|
|
|
sequence<RTCRtpSender> getSenders();
|
|
|
|
sequence<RTCRtpReceiver> getReceivers();
|
|
|
|
|
2013-05-07 17:55:21 -07:00
|
|
|
void close ();
|
|
|
|
attribute EventHandler onnegotiationneeded;
|
|
|
|
attribute EventHandler onicecandidate;
|
|
|
|
attribute EventHandler onsignalingstatechange;
|
|
|
|
attribute EventHandler onaddstream;
|
2014-08-13 18:40:41 -07:00
|
|
|
attribute EventHandler onaddtrack; // replaces onaddstream; see AddTrackEvent
|
2013-05-07 17:55:21 -07:00
|
|
|
attribute EventHandler onremovestream;
|
|
|
|
attribute EventHandler oniceconnectionstatechange;
|
2013-10-17 15:00:05 -07:00
|
|
|
|
2014-12-08 07:36:18 -08:00
|
|
|
Promise<RTCStatsReport> getStats (MediaStreamTrack? selector);
|
2013-05-16 16:40:23 -07:00
|
|
|
|
|
|
|
// Data channel.
|
|
|
|
RTCDataChannel createDataChannel (DOMString label,
|
|
|
|
optional RTCDataChannelInit dataChannelDict);
|
|
|
|
attribute EventHandler ondatachannel;
|
2014-02-10 14:41:46 -08:00
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
attribute EventHandler onidentityresult;
|
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
attribute EventHandler onpeeridentity;
|
2014-04-08 05:26:00 -07:00
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
attribute EventHandler onidpassertionerror;
|
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
attribute EventHandler onidpvalidationerror;
|
2013-05-07 17:55:21 -07:00
|
|
|
};
|
2014-05-22 14:14:56 -07:00
|
|
|
|
2014-12-08 07:36:18 -08:00
|
|
|
// Legacy callback API
|
|
|
|
|
|
|
|
partial interface mozRTCPeerConnection {
|
|
|
|
|
|
|
|
// Dummy Promise<void> return values avoid "WebIDL.WebIDLError: error:
|
|
|
|
// We have overloads with both Promise and non-Promise return types"
|
|
|
|
|
|
|
|
Promise<void> createOffer (RTCSessionDescriptionCallback successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback,
|
|
|
|
optional RTCOfferOptions options);
|
|
|
|
Promise<void> createAnswer (RTCSessionDescriptionCallback successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
|
|
|
Promise<void> setLocalDescription (mozRTCSessionDescription description,
|
|
|
|
VoidFunction successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
|
|
|
Promise<void> setRemoteDescription (mozRTCSessionDescription description,
|
|
|
|
VoidFunction successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
|
|
|
Promise<void> addIceCandidate (mozRTCIceCandidate candidate,
|
|
|
|
VoidFunction successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
|
|
|
Promise<void> getStats (MediaStreamTrack? selector,
|
|
|
|
RTCStatsCallback successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
|
|
|
};
|