/* 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/. */ #include "nsISupports.idl" #include "nsIDOMMediaStream.idl" interface nsIDOMDataChannel; [scriptable, function, uuid(eb9c563c-3b09-4565-9317-eca96ae0c538)] interface RTCPeerConnectionCallback : nsISupports { void onCallback(in jsval value); }; [scriptable, function, uuid(55546efd-287b-4460-8283-0592875b890f)] interface RTCPeerConnectionCallbackVoid : nsISupports { void onCallback(); }; [scriptable, uuid(05d7375e-b024-4951-a570-c6642105ad35)] interface nsIDOMRTCSessionDescription : nsISupports { attribute DOMString sdp; attribute DOMString type; }; [scriptable, uuid(df176474-e20a-4f42-a85b-b0414d634cf0)] interface nsIDOMRTCIceCandidate : nsISupports { attribute DOMString candidate; attribute DOMString sdpMid; attribute unsigned short sdpMLineIndex; }; /* See http://dev.w3.org/2011/webrtc/editor/webrtc.html */ [scriptable, uuid(f888648c-5e6b-4af9-91ad-a911e53d7a39)] interface nsIDOMRTCPeerConnection : nsISupports { void createOffer(in RTCPeerConnectionCallback successCallback, [optional] in RTCPeerConnectionCallback failureCallback, [optional] in jsval constraints); void createAnswer(in RTCPeerConnectionCallback successCallback, [optional] in RTCPeerConnectionCallback failureCallback, [optional] in jsval constraints, [optional] in bool createProvisionalAnswer); void setLocalDescription(in nsIDOMRTCSessionDescription desc, [optional] in RTCPeerConnectionCallback successCallback, [optional] in RTCPeerConnectionCallback failureCallback); void setRemoteDescription(in nsIDOMRTCSessionDescription desc, [optional] in RTCPeerConnectionCallback successCallback, [optional] in RTCPeerConnectionCallback failureCallback); void updateIce([optional] in jsval configuration, [optional] in jsval constraints, [optional] in bool restart); void addIceCandidate(in nsIDOMRTCIceCandidate candidate); void addStream(in nsIDOMMediaStream stream, [optional] in jsval constraints); void removeStream(in nsIDOMMediaStream stream); void close(); /* Readonly attributes */ readonly attribute DOMString iceState; readonly attribute DOMString iceGatheringState; readonly attribute DOMString readyState; readonly attribute jsval localDescription; readonly attribute jsval remoteDescription; readonly attribute jsval localStreams; // MediaStream[] readonly attribute jsval remoteStreams; // MediaStream[] /* Event handlers. TODO: Use real EventTarget */ attribute RTCPeerConnectionCallback onaddstream; attribute RTCPeerConnectionCallback onopen; attribute RTCPeerConnectionCallback onremovestream; attribute RTCPeerConnectionCallback onicecandidate; attribute RTCPeerConnectionCallback onstatechange; attribute RTCPeerConnectionCallback ongatheringchange; attribute RTCPeerConnectionCallback onicechange; /* Data channels */ nsIDOMDataChannel createDataChannel([optional] in ACString label, [optional] in jsval options); void connectDataConnection(in unsigned short localport, in unsigned short remoteport, [optional] in unsigned short numstreams); attribute RTCPeerConnectionCallback ondatachannel; attribute RTCPeerConnectionCallbackVoid onconnection; attribute RTCPeerConnectionCallbackVoid onclosedconnection; };