2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-05-08 04:55:21 +04:00
|
|
|
/* 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
|
2016-02-21 03:48:20 +03:00
|
|
|
* http://w3c.github.io/webrtc-pc/#interface-definition
|
2013-05-08 04:55:21 +04:00
|
|
|
*/
|
|
|
|
|
2016-11-09 19:31:31 +03:00
|
|
|
callback RTCSessionDescriptionCallback = void (RTCSessionDescriptionInit description);
|
2017-08-06 20:47:00 +03:00
|
|
|
callback RTCPeerConnectionErrorCallback = void (DOMException error);
|
2013-10-18 02:00:05 +04:00
|
|
|
callback RTCStatsCallback = void (RTCStatsReport report);
|
2013-05-08 04:55:21 +04: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"
|
|
|
|
};
|
|
|
|
|
2017-06-30 03:14:06 +03:00
|
|
|
enum mozPacketDumpType {
|
|
|
|
"rtp", // dump unencrypted rtp as the MediaPipeline sees it
|
|
|
|
"srtp", // dump encrypted rtp as the MediaPipeline sees it
|
|
|
|
"rtcp", // dump unencrypted rtcp as the MediaPipeline sees it
|
|
|
|
"srtcp" // dump encrypted rtcp as the MediaPipeline sees it
|
|
|
|
};
|
|
|
|
|
|
|
|
callback mozPacketCallback = void (unsigned long level,
|
|
|
|
mozPacketDumpType type,
|
|
|
|
boolean sending,
|
|
|
|
ArrayBuffer packet);
|
|
|
|
|
2013-05-17 03:40:23 +04:00
|
|
|
dictionary RTCDataChannelInit {
|
2016-11-23 00:13:04 +03:00
|
|
|
boolean ordered = true;
|
|
|
|
unsigned short maxPacketLifeTime;
|
|
|
|
unsigned short maxRetransmits;
|
|
|
|
DOMString protocol = "";
|
|
|
|
boolean negotiated = false;
|
|
|
|
unsigned short id;
|
2013-06-04 01:34:42 +04:00
|
|
|
|
2016-11-23 00:13:04 +03:00
|
|
|
// These are deprecated due to renaming in the spec, but still supported for Fx53
|
|
|
|
unsigned short maxRetransmitTime;
|
2013-05-17 03:40:23 +04:00
|
|
|
};
|
|
|
|
|
2015-07-16 22:36:34 +03:00
|
|
|
dictionary RTCOfferAnswerOptions {
|
|
|
|
// boolean voiceActivityDetection = true; // TODO: support this (Bug 1184712)
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary RTCAnswerOptions : RTCOfferAnswerOptions {
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary RTCOfferOptions : RTCOfferAnswerOptions {
|
2017-12-01 20:10:40 +03:00
|
|
|
boolean offerToReceiveVideo;
|
|
|
|
boolean offerToReceiveAudio;
|
2016-04-08 17:20:53 +03:00
|
|
|
boolean iceRestart = false;
|
2013-10-10 06:27:54 +04:00
|
|
|
};
|
|
|
|
|
2013-05-08 04:55:21 +04:00
|
|
|
[Pref="media.peerconnection.enabled",
|
|
|
|
JSImplementation="@mozilla.org/dom/peerconnection;1",
|
|
|
|
Constructor (optional RTCConfiguration configuration,
|
|
|
|
optional object? constraints)]
|
2015-09-28 21:25:04 +03:00
|
|
|
interface RTCPeerConnection : EventTarget {
|
2015-07-06 20:40:04 +03:00
|
|
|
[Throws, StaticClassOverride="mozilla::dom::RTCCertificate"]
|
|
|
|
static Promise<RTCCertificate> generateCertificate (AlgorithmIdentifier keygenAlgorithm);
|
|
|
|
|
2014-02-11 02:41:46 +04:00
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
void setIdentityProvider (DOMString provider,
|
2018-03-19 09:15:37 +03:00
|
|
|
optional RTCIdentityProviderOptions options);
|
2014-02-11 02:41:46 +04:00
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
2015-02-22 00:57:21 +03:00
|
|
|
Promise<DOMString> getIdentityAssertion();
|
2016-11-09 19:31:31 +03:00
|
|
|
Promise<RTCSessionDescriptionInit> createOffer (optional RTCOfferOptions options);
|
|
|
|
Promise<RTCSessionDescriptionInit> createAnswer (optional RTCAnswerOptions options);
|
|
|
|
Promise<void> setLocalDescription (RTCSessionDescriptionInit description);
|
|
|
|
Promise<void> setRemoteDescription (RTCSessionDescriptionInit description);
|
2015-09-28 21:25:04 +03:00
|
|
|
readonly attribute RTCSessionDescription? localDescription;
|
2017-08-31 00:29:28 +03:00
|
|
|
readonly attribute RTCSessionDescription? currentLocalDescription;
|
|
|
|
readonly attribute RTCSessionDescription? pendingLocalDescription;
|
2015-09-28 21:25:04 +03:00
|
|
|
readonly attribute RTCSessionDescription? remoteDescription;
|
2017-08-31 00:29:28 +03:00
|
|
|
readonly attribute RTCSessionDescription? currentRemoteDescription;
|
|
|
|
readonly attribute RTCSessionDescription? pendingRemoteDescription;
|
2013-05-08 04:55:21 +04:00
|
|
|
readonly attribute RTCSignalingState signalingState;
|
2016-11-09 05:36:04 +03:00
|
|
|
Promise<void> addIceCandidate ((RTCIceCandidateInit or RTCIceCandidate)? candidate);
|
2016-02-21 03:48:20 +03:00
|
|
|
readonly attribute boolean? canTrickleIceCandidates;
|
2013-05-08 04:55:21 +04:00
|
|
|
readonly attribute RTCIceGatheringState iceGatheringState;
|
|
|
|
readonly attribute RTCIceConnectionState iceConnectionState;
|
2014-02-11 02:41:46 +04:00
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
2015-02-22 00:57:21 +03:00
|
|
|
readonly attribute Promise<RTCIdentityAssertion> peerIdentity;
|
|
|
|
[Pref="media.peerconnection.identity.enabled"]
|
|
|
|
readonly attribute DOMString? idpLoginUrl;
|
2014-02-11 02:41:46 +04:00
|
|
|
|
2014-05-23 01:14:56 +04:00
|
|
|
[ChromeOnly]
|
2014-11-20 22:43:02 +03:00
|
|
|
attribute DOMString id;
|
2014-05-23 01:14:56 +04:00
|
|
|
|
2014-07-10 22:31:25 +04:00
|
|
|
RTCConfiguration getConfiguration ();
|
2017-12-15 01:03:14 +03:00
|
|
|
[Deprecated="RTCPeerConnectionGetStreams"]
|
2013-05-08 04:55:21 +04:00
|
|
|
sequence<MediaStream> getLocalStreams ();
|
2017-12-15 01:03:14 +03:00
|
|
|
[Deprecated="RTCPeerConnectionGetStreams"]
|
2013-05-08 04:55:21 +04:00
|
|
|
sequence<MediaStream> getRemoteStreams ();
|
2014-07-10 22:31:25 +04:00
|
|
|
void addStream (MediaStream stream);
|
2014-08-14 05:40:41 +04:00
|
|
|
|
|
|
|
// replaces addStream; fails if already added
|
2014-08-14 05:40:54 +04:00
|
|
|
// because a track can be part of multiple streams, stream parameters
|
|
|
|
// indicate which particular streams should be referenced in signaling
|
2014-08-14 05:40:41 +04:00
|
|
|
|
2014-08-14 05:40:54 +04:00
|
|
|
RTCRtpSender addTrack(MediaStreamTrack track,
|
|
|
|
MediaStream stream,
|
|
|
|
MediaStream... moreStreams);
|
2014-08-14 05:40:41 +04:00
|
|
|
void removeTrack(RTCRtpSender sender);
|
|
|
|
|
2017-08-23 23:47:54 +03:00
|
|
|
RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
|
|
|
|
optional RTCRtpTransceiverInit init);
|
|
|
|
|
2014-08-14 05:40:41 +04:00
|
|
|
sequence<RTCRtpSender> getSenders();
|
|
|
|
sequence<RTCRtpReceiver> getReceivers();
|
2017-08-23 23:47:54 +03:00
|
|
|
sequence<RTCRtpTransceiver> getTransceivers();
|
2014-08-14 05:40:41 +04:00
|
|
|
|
2017-11-14 21:29:44 +03:00
|
|
|
// test-only: for testing getContributingSources
|
|
|
|
[ChromeOnly]
|
|
|
|
DOMHighResTimeStamp mozGetNowInRtpSourceReferenceTime();
|
|
|
|
// test-only: for testing getContributingSources
|
|
|
|
[ChromeOnly]
|
|
|
|
void mozInsertAudioLevelForContributingSource(RTCRtpReceiver receiver,
|
|
|
|
unsigned long source,
|
|
|
|
DOMHighResTimeStamp timestamp,
|
|
|
|
boolean hasLevel,
|
|
|
|
byte level);
|
2017-04-26 18:01:07 +03:00
|
|
|
[ChromeOnly]
|
|
|
|
void mozAddRIDExtension(RTCRtpReceiver receiver, unsigned short extensionId);
|
|
|
|
[ChromeOnly]
|
|
|
|
void mozAddRIDFilter(RTCRtpReceiver receiver, DOMString rid);
|
2017-06-30 03:14:06 +03:00
|
|
|
[ChromeOnly]
|
|
|
|
void mozSetPacketCallback(mozPacketCallback callback);
|
|
|
|
[ChromeOnly]
|
|
|
|
void mozEnablePacketDump(unsigned long level,
|
|
|
|
mozPacketDumpType type,
|
|
|
|
boolean sending);
|
|
|
|
[ChromeOnly]
|
|
|
|
void mozDisablePacketDump(unsigned long level,
|
|
|
|
mozPacketDumpType type,
|
|
|
|
boolean sending);
|
2015-12-09 23:37:38 +03:00
|
|
|
|
2013-05-08 04:55:21 +04:00
|
|
|
void close ();
|
|
|
|
attribute EventHandler onnegotiationneeded;
|
|
|
|
attribute EventHandler onicecandidate;
|
|
|
|
attribute EventHandler onsignalingstatechange;
|
2016-01-12 23:09:01 +03:00
|
|
|
attribute EventHandler onaddstream; // obsolete
|
|
|
|
attribute EventHandler onaddtrack; // obsolete
|
|
|
|
attribute EventHandler ontrack; // replaces onaddtrack and onaddstream.
|
2013-05-08 04:55:21 +04:00
|
|
|
attribute EventHandler onremovestream;
|
|
|
|
attribute EventHandler oniceconnectionstatechange;
|
2016-11-19 22:00:09 +03:00
|
|
|
attribute EventHandler onicegatheringstatechange;
|
2013-10-18 02:00:05 +04:00
|
|
|
|
2015-07-21 23:36:10 +03:00
|
|
|
Promise<RTCStatsReport> getStats (optional MediaStreamTrack? selector);
|
2013-05-17 03:40:23 +04:00
|
|
|
|
|
|
|
// Data channel.
|
|
|
|
RTCDataChannel createDataChannel (DOMString label,
|
|
|
|
optional RTCDataChannelInit dataChannelDict);
|
|
|
|
attribute EventHandler ondatachannel;
|
2013-05-08 04:55:21 +04:00
|
|
|
};
|
2014-05-23 01:14:56 +04:00
|
|
|
|
2014-12-08 18:36:18 +03:00
|
|
|
// Legacy callback API
|
|
|
|
|
2015-09-28 21:25:04 +03:00
|
|
|
partial interface RTCPeerConnection {
|
2014-12-08 18:36:18 +03:00
|
|
|
|
|
|
|
// 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);
|
2016-11-09 19:31:31 +03:00
|
|
|
Promise<void> setLocalDescription (RTCSessionDescriptionInit description,
|
2014-12-08 18:36:18 +03:00
|
|
|
VoidFunction successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
2016-11-09 19:31:31 +03:00
|
|
|
Promise<void> setRemoteDescription (RTCSessionDescriptionInit description,
|
2014-12-08 18:36:18 +03:00
|
|
|
VoidFunction successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
2015-09-28 21:25:04 +03:00
|
|
|
Promise<void> addIceCandidate (RTCIceCandidate candidate,
|
2014-12-08 18:36:18 +03:00
|
|
|
VoidFunction successCallback,
|
|
|
|
RTCPeerConnectionErrorCallback failureCallback);
|
|
|
|
};
|