webrtc.idl (18225B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: WebRTC: Real-Time Communication in Browsers (https://w3c.github.io/webrtc-pc/) 5 6 dictionary RTCConfiguration { 7 sequence<RTCIceServer> iceServers = []; 8 RTCIceTransportPolicy iceTransportPolicy = "all"; 9 RTCBundlePolicy bundlePolicy = "balanced"; 10 RTCRtcpMuxPolicy rtcpMuxPolicy = "require"; 11 sequence<RTCCertificate> certificates = []; 12 [EnforceRange] octet iceCandidatePoolSize = 0; 13 }; 14 15 dictionary RTCIceServer { 16 required (USVString or sequence<USVString>) urls; 17 DOMString username; 18 DOMString credential; 19 }; 20 21 enum RTCIceTransportPolicy { 22 "relay", 23 "all" 24 }; 25 26 enum RTCBundlePolicy { 27 "balanced", 28 "max-compat", 29 "max-bundle" 30 }; 31 32 enum RTCRtcpMuxPolicy { 33 "require" 34 }; 35 36 dictionary RTCOfferAnswerOptions {}; 37 38 dictionary RTCOfferOptions : RTCOfferAnswerOptions { 39 boolean iceRestart = false; 40 }; 41 42 dictionary RTCAnswerOptions : RTCOfferAnswerOptions {}; 43 44 enum RTCSignalingState { 45 "stable", 46 "have-local-offer", 47 "have-remote-offer", 48 "have-local-pranswer", 49 "have-remote-pranswer", 50 "closed" 51 }; 52 53 enum RTCIceGatheringState { 54 "new", 55 "gathering", 56 "complete" 57 }; 58 59 enum RTCPeerConnectionState { 60 "closed", 61 "failed", 62 "disconnected", 63 "new", 64 "connecting", 65 "connected" 66 }; 67 68 enum RTCIceConnectionState { 69 "closed", 70 "failed", 71 "disconnected", 72 "new", 73 "checking", 74 "completed", 75 "connected" 76 }; 77 78 [Exposed=Window] 79 interface RTCPeerConnection : EventTarget { 80 constructor(optional RTCConfiguration configuration = {}); 81 Promise<RTCSessionDescriptionInit> createOffer(optional RTCOfferOptions options = {}); 82 Promise<RTCSessionDescriptionInit> createAnswer(optional RTCAnswerOptions options = {}); 83 Promise<undefined> setLocalDescription(optional RTCLocalSessionDescriptionInit description = {}); 84 readonly attribute RTCSessionDescription? localDescription; 85 readonly attribute RTCSessionDescription? currentLocalDescription; 86 readonly attribute RTCSessionDescription? pendingLocalDescription; 87 Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description); 88 readonly attribute RTCSessionDescription? remoteDescription; 89 readonly attribute RTCSessionDescription? currentRemoteDescription; 90 readonly attribute RTCSessionDescription? pendingRemoteDescription; 91 Promise<undefined> addIceCandidate(optional RTCIceCandidateInit candidate = {}); 92 readonly attribute RTCSignalingState signalingState; 93 readonly attribute RTCIceGatheringState iceGatheringState; 94 readonly attribute RTCIceConnectionState iceConnectionState; 95 readonly attribute RTCPeerConnectionState connectionState; 96 readonly attribute boolean? canTrickleIceCandidates; 97 undefined restartIce(); 98 RTCConfiguration getConfiguration(); 99 undefined setConfiguration(optional RTCConfiguration configuration = {}); 100 undefined close(); 101 attribute EventHandler onnegotiationneeded; 102 attribute EventHandler onicecandidate; 103 attribute EventHandler onicecandidateerror; 104 attribute EventHandler onsignalingstatechange; 105 attribute EventHandler oniceconnectionstatechange; 106 attribute EventHandler onicegatheringstatechange; 107 attribute EventHandler onconnectionstatechange; 108 109 // Legacy Interface Extensions 110 // Supporting the methods in this section is optional. 111 // If these methods are supported 112 // they must be implemented as defined 113 // in section "Legacy Interface Extensions" 114 Promise<undefined> createOffer(RTCSessionDescriptionCallback successCallback, 115 RTCPeerConnectionErrorCallback failureCallback, 116 optional RTCOfferOptions options = {}); 117 Promise<undefined> setLocalDescription(RTCLocalSessionDescriptionInit description, 118 VoidFunction successCallback, 119 RTCPeerConnectionErrorCallback failureCallback); 120 Promise<undefined> createAnswer(RTCSessionDescriptionCallback successCallback, 121 RTCPeerConnectionErrorCallback failureCallback); 122 Promise<undefined> setRemoteDescription(RTCSessionDescriptionInit description, 123 VoidFunction successCallback, 124 RTCPeerConnectionErrorCallback failureCallback); 125 Promise<undefined> addIceCandidate(RTCIceCandidateInit candidate, 126 VoidFunction successCallback, 127 RTCPeerConnectionErrorCallback failureCallback); 128 }; 129 130 callback RTCPeerConnectionErrorCallback = undefined (DOMException error); 131 132 callback RTCSessionDescriptionCallback = undefined (RTCSessionDescriptionInit description); 133 134 partial dictionary RTCOfferOptions { 135 boolean offerToReceiveAudio; 136 boolean offerToReceiveVideo; 137 }; 138 139 enum RTCSdpType { 140 "offer", 141 "pranswer", 142 "answer", 143 "rollback" 144 }; 145 146 [Exposed=Window] 147 interface RTCSessionDescription { 148 constructor(RTCSessionDescriptionInit descriptionInitDict); 149 readonly attribute RTCSdpType type; 150 readonly attribute DOMString sdp; 151 [Default] RTCSessionDescriptionInit toJSON(); 152 }; 153 154 dictionary RTCSessionDescriptionInit { 155 required RTCSdpType type; 156 DOMString sdp = ""; 157 }; 158 159 dictionary RTCLocalSessionDescriptionInit { 160 RTCSdpType type; 161 DOMString sdp = ""; 162 }; 163 164 [Exposed=Window] 165 interface RTCIceCandidate { 166 constructor(optional RTCLocalIceCandidateInit candidateInitDict = {}); 167 readonly attribute DOMString candidate; 168 readonly attribute DOMString? sdpMid; 169 readonly attribute unsigned short? sdpMLineIndex; 170 readonly attribute DOMString? foundation; 171 readonly attribute RTCIceComponent? component; 172 readonly attribute unsigned long? priority; 173 readonly attribute DOMString? address; 174 readonly attribute RTCIceProtocol? protocol; 175 readonly attribute unsigned short? port; 176 readonly attribute RTCIceCandidateType? type; 177 readonly attribute RTCIceTcpCandidateType? tcpType; 178 readonly attribute DOMString? relatedAddress; 179 readonly attribute unsigned short? relatedPort; 180 readonly attribute DOMString? usernameFragment; 181 readonly attribute RTCIceServerTransportProtocol? relayProtocol; 182 readonly attribute USVString? url; 183 RTCIceCandidateInit toJSON(); 184 }; 185 186 dictionary RTCIceCandidateInit { 187 DOMString candidate = ""; 188 DOMString? sdpMid = null; 189 unsigned short? sdpMLineIndex = null; 190 DOMString? usernameFragment = null; 191 }; 192 193 dictionary RTCLocalIceCandidateInit : RTCIceCandidateInit { 194 RTCIceServerTransportProtocol? relayProtocol = null; 195 USVString? url = null; 196 }; 197 198 enum RTCIceProtocol { 199 "udp", 200 "tcp" 201 }; 202 203 enum RTCIceTcpCandidateType { 204 "active", 205 "passive", 206 "so" 207 }; 208 209 enum RTCIceCandidateType { 210 "host", 211 "srflx", 212 "prflx", 213 "relay" 214 }; 215 216 enum RTCIceServerTransportProtocol { 217 "udp", 218 "tcp", 219 "tls", 220 }; 221 222 [Exposed=Window] 223 interface RTCPeerConnectionIceEvent : Event { 224 constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict = {}); 225 readonly attribute RTCIceCandidate? candidate; 226 readonly attribute USVString? url; 227 }; 228 229 dictionary RTCPeerConnectionIceEventInit : EventInit { 230 RTCIceCandidate? candidate; 231 USVString? url; 232 }; 233 234 [Exposed=Window] 235 interface RTCPeerConnectionIceErrorEvent : Event { 236 constructor(DOMString type, RTCPeerConnectionIceErrorEventInit eventInitDict); 237 readonly attribute DOMString? address; 238 readonly attribute unsigned short? port; 239 readonly attribute USVString url; 240 readonly attribute unsigned short errorCode; 241 readonly attribute USVString errorText; 242 }; 243 244 dictionary RTCPeerConnectionIceErrorEventInit : EventInit { 245 DOMString? address; 246 unsigned short? port; 247 USVString url; 248 required unsigned short errorCode; 249 USVString errorText; 250 }; 251 252 partial interface RTCPeerConnection { 253 static Promise<RTCCertificate> 254 generateCertificate(AlgorithmIdentifier keygenAlgorithm); 255 }; 256 257 dictionary RTCCertificateExpiration { 258 [EnforceRange] unsigned long long expires; 259 }; 260 261 [Exposed=Window, Serializable] 262 interface RTCCertificate { 263 readonly attribute EpochTimeStamp expires; 264 sequence<RTCDtlsFingerprint> getFingerprints(); 265 }; 266 267 partial interface RTCPeerConnection { 268 sequence<RTCRtpSender> getSenders(); 269 sequence<RTCRtpReceiver> getReceivers(); 270 sequence<RTCRtpTransceiver> getTransceivers(); 271 RTCRtpSender addTrack(MediaStreamTrack track, MediaStream... streams); 272 undefined removeTrack(RTCRtpSender sender); 273 RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind, 274 optional RTCRtpTransceiverInit init = {}); 275 attribute EventHandler ontrack; 276 }; 277 278 dictionary RTCRtpTransceiverInit { 279 RTCRtpTransceiverDirection direction = "sendrecv"; 280 sequence<MediaStream> streams = []; 281 sequence<RTCRtpEncodingParameters> sendEncodings = []; 282 }; 283 284 enum RTCRtpTransceiverDirection { 285 "sendrecv", 286 "sendonly", 287 "recvonly", 288 "inactive", 289 "stopped" 290 }; 291 292 [Exposed=Window] 293 interface RTCRtpSender { 294 readonly attribute MediaStreamTrack? track; 295 readonly attribute RTCDtlsTransport? transport; 296 static RTCRtpCapabilities? getCapabilities(DOMString kind); 297 Promise<undefined> setParameters(RTCRtpSendParameters parameters, 298 optional RTCSetParameterOptions setParameterOptions = {}); 299 RTCRtpSendParameters getParameters(); 300 Promise<undefined> replaceTrack(MediaStreamTrack? withTrack); 301 undefined setStreams(MediaStream... streams); 302 Promise<RTCStatsReport> getStats(); 303 }; 304 305 dictionary RTCRtpParameters { 306 required sequence<RTCRtpHeaderExtensionParameters> headerExtensions; 307 required RTCRtcpParameters rtcp; 308 required sequence<RTCRtpCodecParameters> codecs; 309 }; 310 311 dictionary RTCRtpSendParameters : RTCRtpParameters { 312 required DOMString transactionId; 313 required sequence<RTCRtpEncodingParameters> encodings; 314 }; 315 316 dictionary RTCRtpReceiveParameters : RTCRtpParameters { 317 }; 318 319 dictionary RTCRtpCodingParameters { 320 DOMString rid; 321 }; 322 323 dictionary RTCRtpEncodingParameters : RTCRtpCodingParameters { 324 boolean active = true; 325 RTCRtpCodec codec; 326 unsigned long maxBitrate; 327 double maxFramerate; 328 double scaleResolutionDownBy; 329 }; 330 331 dictionary RTCRtcpParameters { 332 DOMString cname; 333 boolean reducedSize; 334 }; 335 336 dictionary RTCRtpHeaderExtensionParameters { 337 required DOMString uri; 338 required unsigned short id; 339 boolean encrypted = false; 340 }; 341 342 dictionary RTCRtpCodec { 343 required DOMString mimeType; 344 required unsigned long clockRate; 345 unsigned short channels; 346 DOMString sdpFmtpLine; 347 }; 348 349 dictionary RTCRtpCodecParameters : RTCRtpCodec { 350 required octet payloadType; 351 }; 352 353 dictionary RTCRtpCapabilities { 354 required sequence<RTCRtpCodec> codecs; 355 required sequence<RTCRtpHeaderExtensionCapability> headerExtensions; 356 }; 357 358 dictionary RTCRtpHeaderExtensionCapability { 359 required DOMString uri; 360 }; 361 362 dictionary RTCSetParameterOptions { 363 }; 364 365 [Exposed=Window] 366 interface RTCRtpReceiver { 367 readonly attribute MediaStreamTrack track; 368 readonly attribute RTCDtlsTransport? transport; 369 static RTCRtpCapabilities? getCapabilities(DOMString kind); 370 RTCRtpReceiveParameters getParameters(); 371 sequence<RTCRtpContributingSource> getContributingSources(); 372 sequence<RTCRtpSynchronizationSource> getSynchronizationSources(); 373 Promise<RTCStatsReport> getStats(); 374 attribute DOMHighResTimeStamp? jitterBufferTarget; 375 }; 376 377 dictionary RTCRtpContributingSource { 378 required DOMHighResTimeStamp timestamp; 379 required unsigned long source; 380 double audioLevel; 381 required unsigned long rtpTimestamp; 382 }; 383 384 dictionary RTCRtpSynchronizationSource : RTCRtpContributingSource {}; 385 386 [Exposed=Window] 387 interface RTCRtpTransceiver { 388 readonly attribute DOMString? mid; 389 [SameObject] readonly attribute RTCRtpSender sender; 390 [SameObject] readonly attribute RTCRtpReceiver receiver; 391 attribute RTCRtpTransceiverDirection direction; 392 readonly attribute RTCRtpTransceiverDirection? currentDirection; 393 undefined stop(); 394 undefined setCodecPreferences(sequence<RTCRtpCodec> codecs); 395 }; 396 397 [Exposed=Window] 398 interface RTCDtlsTransport : EventTarget { 399 [SameObject] readonly attribute RTCIceTransport iceTransport; 400 readonly attribute RTCDtlsTransportState state; 401 sequence<ArrayBuffer> getRemoteCertificates(); 402 attribute EventHandler onstatechange; 403 attribute EventHandler onerror; 404 }; 405 406 enum RTCDtlsTransportState { 407 "new", 408 "connecting", 409 "connected", 410 "closed", 411 "failed" 412 }; 413 414 dictionary RTCDtlsFingerprint { 415 DOMString algorithm; 416 DOMString value; 417 }; 418 419 [Exposed=Window] 420 interface RTCIceTransport : EventTarget { 421 readonly attribute RTCIceRole role; 422 readonly attribute RTCIceComponent component; 423 readonly attribute RTCIceTransportState state; 424 readonly attribute RTCIceGathererState gatheringState; 425 sequence<RTCIceCandidate> getLocalCandidates(); 426 sequence<RTCIceCandidate> getRemoteCandidates(); 427 RTCIceCandidatePair? getSelectedCandidatePair(); 428 RTCIceParameters? getLocalParameters(); 429 RTCIceParameters? getRemoteParameters(); 430 attribute EventHandler onstatechange; 431 attribute EventHandler ongatheringstatechange; 432 attribute EventHandler onselectedcandidatepairchange; 433 }; 434 435 dictionary RTCIceParameters { 436 DOMString usernameFragment; 437 DOMString password; 438 }; 439 440 [Exposed=Window] 441 interface RTCIceCandidatePair { 442 [SameObject] readonly attribute RTCIceCandidate local; 443 [SameObject] readonly attribute RTCIceCandidate remote; 444 }; 445 446 enum RTCIceGathererState { 447 "new", 448 "gathering", 449 "complete" 450 }; 451 452 enum RTCIceTransportState { 453 "closed", 454 "failed", 455 "disconnected", 456 "new", 457 "checking", 458 "completed", 459 "connected" 460 }; 461 462 enum RTCIceRole { 463 "unknown", 464 "controlling", 465 "controlled" 466 }; 467 468 enum RTCIceComponent { 469 "rtp", 470 "rtcp" 471 }; 472 473 [Exposed=Window] 474 interface RTCTrackEvent : Event { 475 constructor(DOMString type, RTCTrackEventInit eventInitDict); 476 readonly attribute RTCRtpReceiver receiver; 477 readonly attribute MediaStreamTrack track; 478 [SameObject] readonly attribute FrozenArray<MediaStream> streams; 479 readonly attribute RTCRtpTransceiver transceiver; 480 }; 481 482 dictionary RTCTrackEventInit : EventInit { 483 required RTCRtpReceiver receiver; 484 required MediaStreamTrack track; 485 sequence<MediaStream> streams = []; 486 required RTCRtpTransceiver transceiver; 487 }; 488 489 partial interface RTCPeerConnection { 490 readonly attribute RTCSctpTransport? sctp; 491 RTCDataChannel createDataChannel(USVString label, 492 optional RTCDataChannelInit dataChannelDict = {}); 493 attribute EventHandler ondatachannel; 494 }; 495 496 [Exposed=Window] 497 interface RTCSctpTransport : EventTarget { 498 readonly attribute RTCDtlsTransport transport; 499 readonly attribute RTCSctpTransportState state; 500 readonly attribute unrestricted double maxMessageSize; 501 readonly attribute unsigned short? maxChannels; 502 attribute EventHandler onstatechange; 503 }; 504 505 enum RTCSctpTransportState { 506 "connecting", 507 "connected", 508 "closed" 509 }; 510 511 [Exposed=(Window,DedicatedWorker), Transferable] 512 interface RTCDataChannel : EventTarget { 513 readonly attribute USVString label; 514 readonly attribute boolean ordered; 515 readonly attribute unsigned short? maxPacketLifeTime; 516 readonly attribute unsigned short? maxRetransmits; 517 readonly attribute USVString protocol; 518 readonly attribute boolean negotiated; 519 readonly attribute unsigned short? id; 520 readonly attribute RTCDataChannelState readyState; 521 readonly attribute unsigned long bufferedAmount; 522 [EnforceRange] attribute unsigned long bufferedAmountLowThreshold; 523 attribute EventHandler onopen; 524 attribute EventHandler onbufferedamountlow; 525 attribute EventHandler onerror; 526 attribute EventHandler onclosing; 527 attribute EventHandler onclose; 528 undefined close(); 529 attribute EventHandler onmessage; 530 attribute BinaryType binaryType; 531 undefined send(USVString data); 532 undefined send(Blob data); 533 undefined send(ArrayBuffer data); 534 undefined send(ArrayBufferView data); 535 }; 536 537 dictionary RTCDataChannelInit { 538 boolean ordered = true; 539 [EnforceRange] unsigned short maxPacketLifeTime; 540 [EnforceRange] unsigned short maxRetransmits; 541 USVString protocol = ""; 542 boolean negotiated = false; 543 [EnforceRange] unsigned short id; 544 }; 545 546 enum RTCDataChannelState { 547 "connecting", 548 "open", 549 "closing", 550 "closed" 551 }; 552 553 [Exposed=Window] 554 interface RTCDataChannelEvent : Event { 555 constructor(DOMString type, RTCDataChannelEventInit eventInitDict); 556 readonly attribute RTCDataChannel channel; 557 }; 558 559 dictionary RTCDataChannelEventInit : EventInit { 560 required RTCDataChannel channel; 561 }; 562 563 partial interface RTCRtpSender { 564 readonly attribute RTCDTMFSender? dtmf; 565 }; 566 567 [Exposed=Window] 568 interface RTCDTMFSender : EventTarget { 569 undefined insertDTMF(DOMString tones, optional unsigned long duration = 100, optional unsigned long interToneGap = 70); 570 attribute EventHandler ontonechange; 571 readonly attribute boolean canInsertDTMF; 572 readonly attribute DOMString toneBuffer; 573 }; 574 575 [Exposed=Window] 576 interface RTCDTMFToneChangeEvent : Event { 577 constructor(DOMString type, optional RTCDTMFToneChangeEventInit eventInitDict = {}); 578 readonly attribute DOMString tone; 579 }; 580 581 dictionary RTCDTMFToneChangeEventInit : EventInit { 582 DOMString tone = ""; 583 }; 584 585 partial interface RTCPeerConnection { 586 Promise<RTCStatsReport> getStats(optional MediaStreamTrack? selector = null); 587 }; 588 589 [Exposed=Window] 590 interface RTCStatsReport { 591 readonly maplike<DOMString, object>; 592 }; 593 594 dictionary RTCStats { 595 required DOMHighResTimeStamp timestamp; 596 required RTCStatsType type; 597 required DOMString id; 598 }; 599 600 [Exposed=Window] 601 interface RTCError : DOMException { 602 constructor(RTCErrorInit init, optional DOMString message = ""); 603 readonly attribute RTCErrorDetailType errorDetail; 604 readonly attribute long? sdpLineNumber; 605 readonly attribute long? sctpCauseCode; 606 readonly attribute unsigned long? receivedAlert; 607 readonly attribute unsigned long? sentAlert; 608 }; 609 610 dictionary RTCErrorInit { 611 required RTCErrorDetailType errorDetail; 612 long sdpLineNumber; 613 long sctpCauseCode; 614 unsigned long receivedAlert; 615 unsigned long sentAlert; 616 }; 617 618 enum RTCErrorDetailType { 619 "data-channel-failure", 620 "dtls-failure", 621 "fingerprint-failure", 622 "sctp-failure", 623 "sdp-syntax-error", 624 "hardware-encoder-not-available", 625 "hardware-encoder-error" 626 }; 627 628 [Exposed=Window] 629 interface RTCErrorEvent : Event { 630 constructor(DOMString type, RTCErrorEventInit eventInitDict); 631 [SameObject] readonly attribute RTCError error; 632 }; 633 634 dictionary RTCErrorEventInit : EventInit { 635 required RTCError error; 636 };