RTCPeerConnection.addTransceiver()

The RTCPeerConnection method addTransceiver() creates a new RTCRtpTransceiver and adds it to the set of transceivers associated with the RTCPeerConnection. Each transceiver represents a bidirectional stream, with both an RTCRtpSender and an RTCRtpReceiver associated with it.

Syntax

rtpTransceiver = RTCPeerConnection.addTransceiver(trackOrKind, init);

Parameters

trackOrKind

A MediaStreamTrack to associate with the transceiver, or a DOMString which is used as the kind of the receiver's track, and by extension of the RTCRtpReceiver itself.

init Optional

An object that conforms to the RTCRtpTransceiverInit dictionary which provides any options that you may wish to specify when creating the new transceiver. Possible values are: {{page("/en-US/docs/Web/API/RTCRtpTransceiverInit", "Properties")}}

Exceptions

TypeError

A string was specified as trackOrKind which is not valid. The string must be either "audio" or "video".

Specifications

Specification
WebRTC 1.0: Real-Time Communication Between Browsers (WebRTC 1.0)
# dom-rtcpeerconnection-addtransceiver

Browser compatibility

BCD tables only load in the browser

See also