Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

RTCIceTransport: gatheringstatechange event

Baseline2024
Newly available

Agatheringstatechange event is sent to anRTCIceTransport when itsICE candidate gathering state changes.

The gathering state, whose actual status can be found in the transport object'sgatheringState property, indicates whether or not the ICE agent has begun gathering candidates on this transport, and if so, if it has finished doing so.

This event is not cancelable and does not bubble.

Syntax

Use the event name in methods likeaddEventListener(), or set an event handler property.

js
addEventListener("gatheringstatechange", (event) => { })ongatheringstatechange = (event) => { }

Event type

A genericEvent.

Examples

This example creates a handler forgatheringstatechange events on eachRTCRtpSender associated with a givenRTCPeerConnection. Here, theaddEventListener() method is called to add a listener forgatheringstatechange events:

js
pc.getSenders().forEach((sender) => {  sender.transport.iceTransport.addEventListener(    "gatheringstatechange",    (ev) => {      let transport = ev.target;      if (transport.gatheringState === "complete") {        /* this transport has finished gathering candidates,        but others may still be working on it */      }    },    false,  );});

Likewise, you can use theongatheringstatechange event handler property:

js
pc.getSenders().forEach((sender) => {  sender.transport.iceTransport.ongatheringstatechange = (ev) => {    let transport = ev.target;    if (transport.gatheringState === "complete") {      /* this transport has finished gathering candidates,         but others may still be working on it */    }  };});

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# event-icetransport-gatheringstatechange
WebRTC: Real-Time Communication in Browsers
# dom-rtcicetransport-ongatheringstatechange

Browser compatibility

See also

Related RTCIceTransport events

Related RTCPeerConnection events

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp