tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

w3c_rtc.js (21469B)


      1 /*
      2 * Copyright 2012 The Closure Compiler Authors
      3 *
      4 * Licensed under the Apache License, Version 2.0 (the "License");
      5 * you may not use this file except in compliance with the License.
      6 * You may obtain a copy of the License at
      7 *
      8 *     http://www.apache.org/licenses/LICENSE-2.0
      9 *
     10 * Unless required by applicable law or agreed to in writing, software
     11 * distributed under the License is distributed on an "AS IS" BASIS,
     12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 * See the License for the specific language governing permissions and
     14 * limitations under the License.
     15 */
     16 
     17 /**
     18 * @fileoverview Definitions for components of the WebRTC browser API.
     19 * @see http://dev.w3.org/2011/webrtc/editor/webrtc.html
     20 * @see http://tools.ietf.org/html/draft-ietf-rtcweb-jsep-01
     21 * @see http://www.w3.org/TR/mediacapture-streams/
     22 *
     23 * @externs
     24 * @author bemasc@google.com (Benjamin M. Schwartz)
     25 */
     26 
     27 /**
     28 * @typedef {string}
     29 * @see {http://dev.w3.org/2011/webrtc/editor/getusermedia.html
     30 *     #idl-def-MediaStreamTrackState}
     31 * In WebIDL this is an enum with values 'live', 'mute', and 'ended',
     32 * but there is no mechanism in Closure for describing a specialization of
     33 * the string type.
     34 */
     35 var MediaStreamTrackState;
     36 
     37 /**
     38 * @interface
     39 */
     40 function SourceInfo() {}
     41 
     42 /** @const {string} */
     43 SourceInfo.prototype.kind;
     44 
     45 /** @const {string} */
     46 SourceInfo.prototype.id;
     47 
     48 /** @const {?string} */
     49 SourceInfo.prototype.label;
     50 
     51 /** @const {boolean} */
     52 SourceInfo.prototype.facing;
     53 
     54 /**
     55 * @interface
     56 * @see http://www.w3.org/TR/mediacapture-streams/#mediastreamtrack
     57 */
     58 function MediaStreamTrack() {}
     59 
     60 /**
     61 * @param {!function(!Array.<!SourceInfo>)} callback
     62 */
     63 MediaStreamTrack.getSources = function(callback) {};
     64 
     65 /**
     66 * @type {string}
     67 * @const
     68 */
     69 MediaStreamTrack.prototype.kind;
     70 
     71 /**
     72 * @type {string}
     73 * @const
     74 */
     75 MediaStreamTrack.prototype.id;
     76 
     77 /**
     78 * @type {string}
     79 * @const
     80 */
     81 MediaStreamTrack.prototype.label;
     82 
     83 /**
     84 * @type {boolean}
     85 */
     86 MediaStreamTrack.prototype.enabled;
     87 
     88 /**
     89 * @type {MediaStreamTrackState}
     90 * Read only.
     91 */
     92 MediaStreamTrack.prototype.readyState;
     93 
     94 /**
     95 * @type {?function(!Event)}
     96 */
     97 MediaStreamTrack.prototype.onmute;
     98 
     99 /**
    100 * @type {?function(!Event)}
    101 */
    102 MediaStreamTrack.prototype.onunmute;
    103 
    104 /**
    105 * @type {?function(!Event)}
    106 */
    107 MediaStreamTrack.prototype.onended;
    108 
    109 /**
    110 * @return {!MediaStreamTrack}
    111 */
    112 MediaStreamTrack.prototype.clone = function() {};
    113 
    114 /** @return {void} */
    115 MediaStreamTrack.prototype.stop = function() {};
    116 
    117 /**
    118 * @constructor
    119 * @extends {Event}
    120 * @private
    121 * @see http://dev.w3.org/2011/webrtc/editor/
    122 * webrtc-20120720.html#mediastreamtrackevent
    123 * TODO(bemasc): Update this link to the final definition once one exists
    124 * (https://www.w3.org/Bugs/Public/show_bug.cgi?id=19568)
    125 */
    126 function MediaStreamTrackEvent() {}
    127 
    128 /**
    129 * @type {!MediaStreamTrack}
    130 * @const
    131 */
    132 MediaStreamTrackEvent.prototype.track;
    133 
    134 /**
    135 * @param {!MediaStream|!Array.<!MediaStreamTrack>=} streamOrTracks
    136 * @constructor
    137 * @implements {EventTarget}
    138 * @see http://www.w3.org/TR/mediacapture-streams/#mediastream
    139 */
    140 function MediaStream(streamOrTracks) {}
    141 
    142 /**
    143 * @param {boolean=} opt_useCapture
    144 * @override
    145 */
    146 MediaStream.prototype.addEventListener = function(type, listener,
    147    opt_useCapture) {};
    148 
    149 /**
    150 * @param {boolean=} opt_useCapture
    151 * @override
    152 */
    153 MediaStream.prototype.removeEventListener = function(type, listener,
    154    opt_useCapture) {};
    155 
    156 /** @override */
    157 MediaStream.prototype.dispatchEvent = function(evt) {};
    158 
    159 /**
    160 * TODO(bemasc): Remove this property.
    161 * @deprecated
    162 * @type {string}
    163 * @const
    164 */
    165 MediaStream.prototype.label;
    166 
    167 /**
    168 * @type {string}
    169 * @const
    170 */
    171 MediaStream.prototype.id;
    172 
    173 /**
    174 * @return {!Array.<!MediaStreamTrack>}
    175 */
    176 MediaStream.prototype.getAudioTracks = function() {};
    177 
    178 /**
    179 * @return {!Array.<!MediaStreamTrack>}
    180 */
    181 MediaStream.prototype.getVideoTracks = function() {};
    182 
    183 /**
    184 * @param {string} trackId
    185 * @return {MediaStreamTrack}
    186 */
    187 MediaStream.prototype.getTrackById = function(trackId) {};
    188 
    189 /**
    190 * @param {!MediaStreamTrack} track
    191 */
    192 MediaStream.prototype.addTrack = function(track) {};
    193 
    194 /**
    195 * @param {!MediaStreamTrack} track
    196 */
    197 MediaStream.prototype.removeTrack = function(track) {};
    198 
    199 /**
    200 * @type {boolean}
    201 */
    202 MediaStream.prototype.ended;
    203 
    204 /**
    205 * @type {?function(!Event)}
    206 */
    207 MediaStream.prototype.onended;
    208 
    209 /**
    210 * @type {?function(!MediaStreamTrackEvent)}
    211 */
    212 MediaStream.prototype.onaddtrack;
    213 
    214 /**
    215 * @type {?function(!MediaStreamTrackEvent)}
    216 */
    217 MediaStream.prototype.onremovetrack;
    218 
    219 /**
    220 * @deprecated
    221 * TODO(bemasc): Remove this method once browsers have updated to
    222 * MediaStreamTrack.stop().
    223 */
    224 MediaStream.prototype.stop = function() {};
    225 
    226 /**
    227 * @type {function(new: MediaStream,
    228 *                 (!MediaStream|!Array.<!MediaStreamTrack>)=)}
    229 */
    230 var webkitMediaStream;
    231 
    232 /**
    233 * This interface defines the available constraint attributes.  These are the
    234 * attributes defined in
    235 * {@see http://tools.ietf.org/html/draft-alvestrand-constraints-resolution-01}.
    236 * Note that although that draft refers to "Media Constraints", the W3C uses
    237 * the terms "Media[Stream|Track]Constraints" for this type, and
    238 * defines a different type (for RTCPeerConnection) called "MediaConstraints".
    239 *
    240 * This interface type is not part of any standard, so it is marked as private.
    241 * It is defined here in order to reserve the property names, which would
    242 * otherwise be rewritten when the compiler processes an object literal.
    243 * Several subsequent interfaces are defined in the same pattern.
    244 *
    245 * Note that although this list includes all the properties supported by
    246 * libjingle (and hence by Chromium), browsers are permitted to offer other
    247 * properties as well ({
    248 * @see http://tools.ietf.org/html/draft-burnett-rtcweb-constraints-registry-02
    249 * }), and browsers are expected to silently ignore unknown properties.  This
    250 * creates the potential for a very confusing situation in which properties
    251 * not listed here are renamed by the compiler and then ignored by the browser.
    252 *
    253 * @interface
    254 * @private
    255 */
    256 function MediaTrackConstraintSetInterface_() {}
    257 
    258 /**
    259 * @type {?number}
    260 */
    261 MediaTrackConstraintSetInterface_.prototype.minWidth;
    262 
    263 /**
    264 * @type {?number}
    265 */
    266 MediaTrackConstraintSetInterface_.prototype.maxWidth;
    267 
    268 /**
    269 * @type {?number}
    270 */
    271 MediaTrackConstraintSetInterface_.prototype.minHeight;
    272 
    273 /**
    274 * @type {?number}
    275 */
    276 MediaTrackConstraintSetInterface_.prototype.maxHeight;
    277 
    278 /**
    279 * @type {?number}
    280 */
    281 MediaTrackConstraintSetInterface_.prototype.minAspectRatio;
    282 
    283 /**
    284 * @type {?number}
    285 */
    286 MediaTrackConstraintSetInterface_.prototype.maxAspectRatio;
    287 
    288 /**
    289 * Due to a typo, this is called "minFramerate" in the -01 draft.
    290 * @type {?number}
    291 */
    292 MediaTrackConstraintSetInterface_.prototype.minFrameRate;
    293 
    294 /**
    295 * @type {?number}
    296 */
    297 MediaTrackConstraintSetInterface_.prototype.maxFrameRate;
    298 
    299 /**
    300 * This type and two more below are defined as unions with Object because they
    301 * are normally used as record types by constructing an Object literal, but all
    302 * of their properties are optional.
    303 * @typedef {Object|MediaTrackConstraintSetInterface_}
    304 */
    305 var MediaTrackConstraintSet;
    306 
    307 /**
    308 * @interface
    309 * @private
    310 */
    311 function MediaTrackConstraintsInterface_() {}
    312 
    313 /**
    314 * @type {?MediaTrackConstraintSet}
    315 */
    316 MediaTrackConstraintsInterface_.prototype.mandatory;
    317 
    318 /**
    319 * @type {?Array.<!MediaTrackConstraintSet>}
    320 */
    321 MediaTrackConstraintsInterface_.prototype.optional;
    322 
    323 /**
    324 * @typedef {Object|MediaTrackConstraintsInterface_}
    325 */
    326 var MediaTrackConstraints;
    327 
    328 /**
    329 * @interface
    330 * @private
    331 */
    332 function MediaStreamConstraintsInterface_() {}
    333 
    334 /**
    335 * @type {boolean|MediaTrackConstraints}
    336 */
    337 MediaStreamConstraintsInterface_.prototype.audio;
    338 
    339 /**
    340 * @type {boolean|MediaTrackConstraints}
    341 */
    342 MediaStreamConstraintsInterface_.prototype.video;
    343 
    344 /**
    345 * @typedef {Object|MediaStreamConstraintsInterface_}
    346 */
    347 var MediaStreamConstraints;
    348 
    349 /**
    350 * @see {http://dev.w3.org/2011/webrtc/editor/getusermedia.html#
    351 *     navigatorusermediaerror-and-navigatorusermediaerrorcallback}
    352 * @interface
    353 */
    354 function NavigatorUserMediaError() {}
    355 
    356 /**
    357 * @type {number}
    358 * @deprecated Removed from the standard and some browsers.
    359 * @const
    360 */
    361 NavigatorUserMediaError.prototype.PERMISSION_DENIED;  /** 1 */
    362 
    363 /**
    364 * @type {number}
    365 * @deprecated Removed from the standard and some browsers.
    366 * Read only.
    367 */
    368 NavigatorUserMediaError.prototype.code;
    369 
    370 /**
    371 * @type {string}
    372 * Read only.
    373 */
    374 NavigatorUserMediaError.prototype.name;
    375 
    376 /**
    377 * @type {?string}
    378 * Read only.
    379 */
    380 NavigatorUserMediaError.prototype.message;
    381 
    382 /**
    383 * @type {?string}
    384 * Read only.
    385 */
    386 NavigatorUserMediaError.prototype.constraintName;
    387 
    388 /**
    389 * @param {MediaStreamConstraints} constraints A MediaStreamConstraints object.
    390 * @param {function(!MediaStream)} successCallback
    391 *     A NavigatorUserMediaSuccessCallback function.
    392 * @param {function(!NavigatorUserMediaError)=} errorCallback A
    393 *     NavigatorUserMediaErrorCallback function.
    394 * @see http://dev.w3.org/2011/webrtc/editor/getusermedia.html
    395 * @see http://www.w3.org/TR/mediacapture-streams/
    396 */
    397 Navigator.prototype.webkitGetUserMedia =
    398  function(constraints, successCallback, errorCallback) {};
    399 
    400 /**
    401 * @param {string} type
    402 * @param {!Object} eventInitDict
    403 * @constructor
    404 */
    405 function MediaStreamEvent(type, eventInitDict) {}
    406 
    407 /**
    408 * @type {?MediaStream}
    409 * @const
    410 */
    411 MediaStreamEvent.prototype.stream;
    412 
    413 /**
    414 * @typedef {string}
    415 * @see http://www.w3.org/TR/webrtc/#rtcsdptype
    416 * In WebIDL this is an enum with values 'offer', 'pranswer', and 'answer',
    417 * but there is no mechanism in Closure for describing a specialization of
    418 * the string type.
    419 */
    420 var RTCSdpType;
    421 
    422 /**
    423 * @param {!Object=} descriptionInitDict The RTCSessionDescriptionInit
    424 * dictionary.  This optional argument may have type
    425 * {type:RTCSdpType, sdp:string}, but neither of these keys are required to be
    426 * present, and other keys are ignored, so the closest Closure type is Object.
    427 * @constructor
    428 * @see http://dev.w3.org/2011/webrtc/editor/webrtc.html#rtcsessiondescription-class
    429 */
    430 function RTCSessionDescription(descriptionInitDict) {}
    431 
    432 /**
    433 * @type {?RTCSdpType}
    434 * @see http://www.w3.org/TR/webrtc/#widl-RTCSessionDescription-type
    435 */
    436 RTCSessionDescription.prototype.type;
    437 
    438 /**
    439 * @type {?string}
    440 * @see http://www.w3.org/TR/webrtc/#widl-RTCSessionDescription-sdp
    441 */
    442 RTCSessionDescription.prototype.sdp;
    443 
    444 /**
    445 * TODO(bemasc): Remove this definition once it is removed from the browser.
    446 * @param {string} label The label index (audio/video/data -> 0,1,2)
    447 * @param {string} sdp The ICE candidate in SDP text form
    448 * @constructor
    449 */
    450 function IceCandidate(label, sdp) {}
    451 
    452 /**
    453 * @return {string}
    454 */
    455 IceCandidate.prototype.toSdp = function() {};
    456 
    457 /**
    458 * @type {?string}
    459 */
    460 IceCandidate.prototype.label;
    461 
    462 /**
    463 * @param {!Object=} candidateInitDict  The RTCIceCandidateInit dictionary.
    464 * This optional argument may have type
    465 * {candidate: string, sdpMid: string, sdpMLineIndex:number}, but none of
    466 * these keys are required to be present, and other keys are ignored, so the
    467 * closest Closure type is Object.
    468 * @constructor
    469 * @see http://www.w3.org/TR/webrtc/#rtcicecandidate-type
    470 */
    471 function RTCIceCandidate(candidateInitDict) {}
    472 
    473 /**
    474 * @type {?string}
    475 */
    476 RTCIceCandidate.prototype.candidate;
    477 
    478 /**
    479 * @type {?string}
    480 */
    481 RTCIceCandidate.prototype.sdpMid;
    482 
    483 /**
    484 * @type {?number}
    485 */
    486 RTCIceCandidate.prototype.sdpMLineIndex;
    487 
    488 /**
    489 * @typedef {{url: string}}
    490 * @private
    491 * @see http://www.w3.org/TR/webrtc/#rtciceserver-type
    492 * This dictionary type also has an optional key {credential: ?string}.
    493 */
    494 var RTCIceServerRecord_;
    495 
    496 /**
    497 * @interface
    498 * @private
    499 */
    500 function RTCIceServerInterface_() {}
    501 
    502 /**
    503 * @type {string}
    504 */
    505 RTCIceServerInterface_.prototype.url;
    506 
    507 /**
    508 * @type {?string}
    509 */
    510 RTCIceServerInterface_.prototype.credential;
    511 
    512 /**
    513 * This type, and several below it, are constructed as unions between records
    514 *
    515 * @typedef {RTCIceServerRecord_|RTCIceServerInterface_}
    516 * @private
    517 */
    518 var RTCIceServer;
    519 
    520 /**
    521 * @typedef {{iceServers: !Array.<!RTCIceServer>}}
    522 * @private
    523 */
    524 var RTCConfigurationRecord_;
    525 
    526 /**
    527 * @interface
    528 * @private
    529 */
    530 function RTCConfigurationInterface_() {}
    531 
    532 /**
    533 * @type {!Array.<!RTCIceServer>}
    534 */
    535 RTCConfigurationInterface_.prototype.iceServers;
    536 
    537 /**
    538 * @typedef {RTCConfigurationRecord_|RTCConfigurationInterface_}
    539 */
    540 var RTCConfiguration;
    541 
    542 /**
    543 * @typedef {function(!RTCSessionDescription)}
    544 */
    545 var RTCSessionDescriptionCallback;
    546 
    547 /**
    548 * @typedef {function(string)}
    549 */
    550 var RTCPeerConnectionErrorCallback;
    551 
    552 /**
    553 * @typedef {function()}
    554 */
    555 var RTCVoidCallback;
    556 
    557 /**
    558 * @typedef {string}
    559 */
    560 var RTCSignalingState;
    561 
    562 /**
    563 * @typedef {string}
    564 */
    565 var RTCIceConnectionState;
    566 
    567 /**
    568 * @typedef {string}
    569 */
    570 var RTCIceGatheringState;
    571 
    572 /**
    573 * @param {string} type
    574 * @param {!Object} eventInitDict
    575 * @constructor
    576 */
    577 function RTCPeerConnectionIceEvent(type, eventInitDict) {}
    578 
    579 /**
    580 * @type {RTCIceCandidate}
    581 * @const
    582 */
    583 RTCPeerConnectionIceEvent.prototype.candidate;
    584 
    585 // Note: The specification of RTCStats types is still under development.
    586 // Declarations here will be updated and removed to follow the development of
    587 // modern browsers, breaking compatibility with older versions as they become
    588 // obsolete.
    589 /**
    590 * @interface
    591 */
    592 function RTCStatsReport() {}
    593 
    594 /**
    595 * @type {Date}
    596 * @const
    597 */
    598 RTCStatsReport.prototype.timestamp;
    599 
    600 /**
    601 * @return {!Array.<!string>}
    602 */
    603 RTCStatsReport.prototype.names = function() {};
    604 
    605 /**
    606 * @param {string} name
    607 * @return {string}
    608 */
    609 RTCStatsReport.prototype.stat = function(name) {};
    610 
    611 /**
    612 * @deprecated
    613 * @type {RTCStatsReport}
    614 * @const
    615 */
    616 RTCStatsReport.prototype.local;
    617 
    618 /**
    619 * @deprecated
    620 * @type {RTCStatsReport}
    621 * @const
    622 */
    623 RTCStatsReport.prototype.remote;
    624 
    625 /**
    626 * @type {string}
    627 * @const
    628 */
    629 RTCStatsReport.prototype.type;
    630 
    631 /**
    632 * @type {string}
    633 * @const
    634 */
    635 RTCStatsReport.prototype.id;
    636 
    637 /**
    638 * TODO(bemasc): Remove this type once it is no longer in use.  It has already
    639 * been removed from the specification.
    640 * @typedef {RTCStatsReport}
    641 * @deprecated
    642 */
    643 var RTCStatsElement;
    644 
    645 /**
    646 * @interface
    647 */
    648 function RTCStatsResponse() {}
    649 
    650 /**
    651 * @return {!Array.<!RTCStatsReport>}
    652 */
    653 RTCStatsResponse.prototype.result = function() {};
    654 
    655 /**
    656 * @typedef {function(!RTCStatsResponse, MediaStreamTrack=)}
    657 */
    658 var RTCStatsCallback;
    659 
    660 /**
    661 * This type is not yet standardized, so the properties here only represent
    662 * the current capabilities of libjingle (and hence Chromium).
    663 * TODO(bemasc): Add a link to the relevant standard once MediaConstraint has a
    664 * standard definition.
    665 *
    666 * @interface
    667 * @private
    668 */
    669 function MediaConstraintSetInterface_() {}
    670 
    671 /**
    672 * @type {?boolean}
    673 */
    674 MediaConstraintSetInterface_.prototype.OfferToReceiveAudio;
    675 
    676 /**
    677 * @type {?boolean}
    678 */
    679 MediaConstraintSetInterface_.prototype.OfferToReceiveVideo;
    680 
    681 /**
    682 * @type {?boolean}
    683 */
    684 MediaConstraintSetInterface_.prototype.DtlsSrtpKeyAgreement;
    685 
    686 /**
    687 * @type {?boolean}
    688 */
    689 MediaConstraintSetInterface_.prototype.RtpDataChannels;
    690 
    691 /**
    692 * TODO(bemasc): Make this type public once it is defined in a standard.
    693 *
    694 * @typedef {Object|MediaConstraintSetInterface_}
    695 * @private
    696 */
    697 var MediaConstraintSet_;
    698 
    699 /**
    700 * @interface
    701 * @private
    702 */
    703 function MediaConstraintsInterface_() {}
    704 
    705 /**
    706 * @type {?MediaConstraintSet_}
    707 */
    708 MediaConstraintsInterface_.prototype.mandatory;
    709 
    710 /**
    711 * @type {?Array.<!MediaConstraintSet_>}
    712 */
    713 MediaConstraintsInterface_.prototype.optional;
    714 
    715 /**
    716 * This type is used extensively in
    717 * {@see http://dev.w3.org/2011/webrtc/editor/webrtc.html} but is not yet
    718 * defined.
    719 *
    720 * @typedef {Object|MediaConstraintsInterface_}
    721 */
    722 var MediaConstraints;
    723 
    724 /**
    725 * @interface
    726 */
    727 function RTCDataChannel() {}
    728 
    729 /**
    730 * @type {string}
    731 * @const
    732 */
    733 RTCDataChannel.prototype.label;
    734 
    735 /**
    736 * @type {boolean}
    737 * @const
    738 */
    739 RTCDataChannel.prototype.reliable;
    740 
    741 /**
    742 * An enumerated string type (RTCDataChannelState) with values:
    743 * "connecting", "open", "closing", and "closed".
    744 * @type {string}
    745 * Read only.
    746 */
    747 RTCDataChannel.prototype.readyState;
    748 
    749 /**
    750 * @type {number}
    751 * Read only.
    752 */
    753 RTCDataChannel.prototype.bufferedAmount;
    754 
    755 /**
    756 * @type {?function(!Event)}
    757 */
    758 RTCDataChannel.prototype.onopen;
    759 
    760 /**
    761 * @type {?function(!Event)}
    762 */
    763 RTCDataChannel.prototype.onerror;
    764 
    765 /**
    766 * @type {?function(!Event)}
    767 */
    768 RTCDataChannel.prototype.onclose;
    769 
    770 RTCDataChannel.prototype.close = function() {};
    771 
    772 /**
    773 * @type {?function(!MessageEvent.<*>)}
    774 */
    775 RTCDataChannel.prototype.onmessage;
    776 
    777 /**
    778 * @type {string}
    779 */
    780 RTCDataChannel.prototype.binaryType;
    781 
    782 /**
    783 * @param {string|!Blob|!ArrayBuffer|!ArrayBufferView} data
    784 */
    785 RTCDataChannel.prototype.send = function(data) {};
    786 
    787 /**
    788 * @constructor
    789 * @extends {Event}
    790 * @private
    791 */
    792 function RTCDataChannelEvent() {}
    793 
    794 /**
    795 * @type {!RTCDataChannel}
    796 * Read only.
    797 */
    798 RTCDataChannelEvent.prototype.channel;
    799 
    800 /**
    801 * @typedef {{reliable: boolean}}
    802 */
    803 var RTCDataChannelInitRecord_;
    804 
    805 /**
    806 * @interface
    807 * @private
    808 */
    809 function RTCDataChannelInitInterface_() {}
    810 
    811 /**
    812 * @type {boolean}
    813 */
    814 RTCDataChannelInitInterface_.prototype.reliable;
    815 
    816 /**
    817 * @typedef {RTCDataChannelInitInterface_|RTCDataChannelInitRecord_}
    818 */
    819 var RTCDataChannelInit;
    820 
    821 /**
    822 * @param {RTCConfiguration} configuration
    823 * @param {!MediaConstraints=} constraints
    824 * @constructor
    825 * @implements {EventTarget}
    826 */
    827 function RTCPeerConnection(configuration, constraints) {}
    828 
    829 /**
    830 * @param {boolean=} opt_useCapture
    831 * @override
    832 */
    833 RTCPeerConnection.prototype.addEventListener = function(
    834    type, listener, opt_useCapture) {};
    835 
    836 /**
    837 * @param {boolean=} opt_useCapture
    838 * @override
    839 */
    840 RTCPeerConnection.prototype.removeEventListener = function(
    841    type, listener, opt_useCapture) {};
    842 
    843 /** @override */
    844 RTCPeerConnection.prototype.dispatchEvent = function(evt) {};
    845 
    846 /**
    847 * @param {!RTCSessionDescriptionCallback} successCallback
    848 * @param {!RTCPeerConnectionErrorCallback=} failureCallback
    849 * @param {!MediaConstraints=} constraints
    850 */
    851 RTCPeerConnection.prototype.createOffer = function(successCallback,
    852    failureCallback, constraints) {};
    853 
    854 /**
    855 * @param {RTCSessionDescriptionCallback} successCallback
    856 * @param {?RTCPeerConnectionErrorCallback=} failureCallback
    857 * @param {!MediaConstraints=} constraints
    858 */
    859 RTCPeerConnection.prototype.createAnswer = function(successCallback,
    860    failureCallback, constraints) {};
    861 
    862 /**
    863 * @param {!RTCSessionDescription} description
    864 * @param {!RTCVoidCallback=} successCallback
    865 * @param {!RTCPeerConnectionErrorCallback=} failureCallback
    866 */
    867 RTCPeerConnection.prototype.setLocalDescription = function(description,
    868    successCallback, failureCallback) {};
    869 
    870 /**
    871 * @param {!RTCSessionDescription} description
    872 * @param {!RTCVoidCallback=} successCallback
    873 * @param {!RTCPeerConnectionErrorCallback=} failureCallback
    874 */
    875 RTCPeerConnection.prototype.setRemoteDescription = function(description,
    876    successCallback, failureCallback) {};
    877 
    878 /**
    879 * @type {?RTCSessionDescription}
    880 * Read only.
    881 */
    882 RTCPeerConnection.prototype.localDescription;
    883 
    884 /**
    885 * @type {?RTCSessionDescription}
    886 * Read only.
    887 */
    888 RTCPeerConnection.prototype.remoteDescription;
    889 
    890 /**
    891 * @type {RTCSignalingState}
    892 * Read only.
    893 */
    894 RTCPeerConnection.prototype.signalingState;
    895 
    896 /**
    897 * @param {?RTCConfiguration=} configuration
    898 * @param {?MediaConstraints=} constraints
    899 */
    900 RTCPeerConnection.prototype.updateIce = function(configuration, constraints) {};
    901 
    902 /**
    903 * @param {!RTCIceCandidate} candidate
    904 */
    905 RTCPeerConnection.prototype.addIceCandidate = function(candidate) {};
    906 
    907 /**
    908 * @type {!RTCIceGatheringState}
    909 * Read only.
    910 */
    911 RTCPeerConnection.prototype.iceGatheringState;
    912 
    913 /**
    914 * @type {!RTCIceConnectionState}
    915 * Read only.
    916 */
    917 RTCPeerConnection.prototype.iceConnectionState;
    918 
    919 /**
    920 * @return {!Array.<!MediaStream>}
    921 */
    922 RTCPeerConnection.prototype.getLocalStreams = function() {};
    923 
    924 /**
    925 * @return {!Array.<!MediaStream>}
    926 */
    927 RTCPeerConnection.prototype.getRemoteStreams = function() {};
    928 
    929 /**
    930 * @param {string} streamId
    931 * @return {MediaStream}
    932 */
    933 RTCPeerConnection.prototype.getStreamById = function(streamId) {};
    934 
    935 /**
    936 * @param {?string} label
    937 * @param {RTCDataChannelInit=} dataChannelDict
    938 * @return {!RTCDataChannel}
    939 */
    940 RTCPeerConnection.prototype.createDataChannel =
    941    function(label, dataChannelDict) {};
    942 /**
    943 * @param {!MediaStream} stream
    944 * @param {!MediaConstraints=} constraints
    945 */
    946 RTCPeerConnection.prototype.addStream = function(stream, constraints) {};
    947 
    948 /**
    949 * @param {!MediaStream} stream
    950 */
    951 RTCPeerConnection.prototype.removeStream = function(stream) {};
    952 
    953 // TODO(bemasc): Add identity provider stuff once implementations exist
    954 
    955 /**
    956 * @param {!RTCStatsCallback} successCallback
    957 * @param {MediaStreamTrack=} selector
    958 */
    959 RTCPeerConnection.prototype.getStats = function(successCallback, selector) {};
    960 
    961 RTCPeerConnection.prototype.close = function() {};
    962 
    963 /**
    964 * @type {?function(!Event)}
    965 */
    966 RTCPeerConnection.prototype.onnegotiationneeded;
    967 
    968 /**
    969 * @type {?function(!RTCPeerConnectionIceEvent)}
    970 */
    971 RTCPeerConnection.prototype.onicecandidate;
    972 
    973 /**
    974 * @type {?function(!Event)}
    975 */
    976 RTCPeerConnection.prototype.onsignalingstatechange;
    977 
    978 /**
    979 * @type {?function(!MediaStreamEvent)}
    980 */
    981 RTCPeerConnection.prototype.onaddstream;
    982 
    983 /**
    984 * @type {?function(!MediaStreamEvent)}
    985 */
    986 RTCPeerConnection.prototype.onremovestream;
    987 
    988 /**
    989 * @type {?function(!Event)}
    990 */
    991 RTCPeerConnection.prototype.oniceconnectionstatechange;
    992 
    993 /**
    994 * @type {?function(!RTCDataChannelEvent)}
    995 */
    996 RTCPeerConnection.prototype.ondatachannel;
    997 
    998 /**
    999 * @type {function(new: RTCPeerConnection, RTCConfiguration,
   1000 *     !MediaConstraints=)}
   1001 */
   1002 var webkitRTCPeerConnection;