1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * PeerConnection.js' interface to the C++ PeerConnectionImpl.
8 * Do not confuse with mozRTCPeerConnection. This interface is purely for
9 * communication between the PeerConnection JS DOM binding and the C++
10 * implementation in SIPCC.
12 * See media/webrtc/signaling/include/PeerConnectionImpl.h
16 interface nsISupports;
18 /* Must be created first. Observer events will be dispatched on the thread provided */
19 [ChromeOnly, Constructor]
20 interface PeerConnectionImpl {
21 /* Must be called first. Observer events dispatched on the thread provided */
23 void initialize(PeerConnectionObserver observer, Window window,
24 RTCConfiguration iceServers,
28 void createOffer(optional RTCOfferOptions options);
32 void setLocalDescription(long action, DOMString sdp);
34 void setRemoteDescription(long action, DOMString sdp);
36 /* Stats call, calls either |onGetStatsSuccess| or |onGetStatsError| on our
37 observer. (see the |PeerConnectionObserver| interface) */
39 void getStats(MediaStreamTrack? selector);
41 /* Adds the tracks created by GetUserMedia */
43 void addTrack(MediaStreamTrack track, MediaStream... streams);
45 void removeTrack(MediaStreamTrack track);
47 void replaceTrack(MediaStreamTrack thisTrack, MediaStreamTrack withTrack,
52 sequence<MediaStream> getLocalStreams();
53 sequence<MediaStream> getRemoteStreams();
55 /* As the ICE candidates roll in this one should be called each time
56 * in order to keep the candidate list up-to-date for the next SDP-related
57 * call PeerConnectionImpl does not parse ICE candidates, just sticks them
61 void addIceCandidate(DOMString candidate, DOMString mid, unsigned short level);
63 /* Puts the SIPCC engine back to 'kIdle', shuts down threads, deletes state */
66 /* Notify DOM window if this plugin crash is ours. */
67 boolean pluginCrash(unsigned long long pluginId, DOMString name, DOMString pluginDumpID);
70 readonly attribute DOMString fingerprint;
71 readonly attribute DOMString localDescription;
72 readonly attribute DOMString remoteDescription;
74 readonly attribute PCImplIceConnectionState iceConnectionState;
75 readonly attribute PCImplIceGatheringState iceGatheringState;
76 readonly attribute PCImplSignalingState signalingState;
77 readonly attribute PCImplSipccState sipccState;
78 readonly attribute DOMString id;
80 attribute DOMString peerIdentity;
81 readonly attribute boolean privacyRequested;
85 DataChannel createDataChannel(DOMString label, DOMString protocol,
86 unsigned short type, boolean outOfOrderAllowed,
87 unsigned short maxTime, unsigned short maxNum,
88 boolean externalNegotiated, unsigned short stream);
90 void connectDataConnection(unsigned short localport,
91 unsigned short remoteport, unsigned short numstreams);