RTCPeerConnection: getTransceivers() method

The RTCPeerConnection interface's getTransceivers() method returns a list of the RTCRtpTransceiver objects being used to send and receive data on the connection.

Syntax

js

getTransceivers()

Parameters

None.

Return value

An array of the RTCRtpTransceiver objects representing the transceivers handling sending and receiving all media on the RTCPeerConnection. The list is in the order in which the transceivers were added to the connection.

Examples

The following snippet of code stops all transceivers associated with an RTCPeerConnection.

js

pc.getTransceivers().forEach((transceiver) => {
  transceiver.stop();
});

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# dom-peerconnection-gettranseceivers

Browser compatibility

BCD tables only load in the browser

See also