Firefox Tomorrow

web api instance method

RTCPeerConnection: addTransceiver() method

View on MDN ↗

The addTransceiver() method of the RTCPeerConnection interface 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

addTransceiver(trackOrKind)
addTransceiver(trackOrKind, init)

Parameters

  • trackOrKind
  • init Optional
    • : An object for specifying any options when creating the new transceiver. Possible values are:

Return value

The RTCRtpTransceiver object which will be used to exchange the media data.

Exceptions

  • TypeError

    • : Thrown if trackOrKind was not either "audio" or "video".

      If the sendEncodings argument is used, this error may also be thrown if there is a badly formatted rid member, some but not all encodings contain a rid member, or different encodings have the same rid value.

  • RangeError

    • : Thrown if any of the sendEncodings encodings have a maxFramerate value less than 0.0, or a scaleResolutionDownBy value of less than 1.0.
  • InvalidStateError DOMException

    • : Thrown if the method is called when the associated connection is closed.
  • InvalidAccessError DOMException

    • : Thrown if the sendEncodings argument is used, and contains a read-only parameter other than rid.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also