RTCRtpTransceiver.direction

The RTCRtpTransceiver property direction is a string which indicates the transceiver's preferred directionality. Its value must be one of the strings defined by the RTCRtpTransceiverDirection (en-US) enumeration.

The transceiver's current direction is indicated by the currentDirection (en-US) property.

Syntax

var direction = RTCRtpTransceiver.direction

Value

A DOMString whose value is one of the strings which are a member of the RTCRtpTransceiverDirection enumerated type, indicating the transceiver's preferred direction. {{page("/en-US/docs/Web/API/RTCRtpTransceiverDirection", "Values")}}

Exceptions

When setting the value of direction, the following exceptions can occur:

InvalidStateError

Either the receiver's RTCPeerConnection is closed or the RTCRtpReceiver (en-US) is stopped.

Usage notes

Setting the direction

When you change the value of direction, an InvalidStateError exception will occur if the connection is closed or the receiver is stopped.

If the new value of direction is in fact different from the existing value, renegotiation of the connection is required, so a negotiationneeded event is sent to the RTCPeerConnection.

Effect on offers and answers

The value of direction is used by RTCPeerConnection.createOffer() or RTCPeerConnection.createAnswer() (en-US) in order to generate the SDP generated by each of those methods. The SDP contains an a-line which specifies the directionality. For example, if the direction is specified as "sendrecv", the corresponding SDP a-line is:

a=sendrecv

Specifications

Specification
WebRTC 1.0: Real-Time Communication Between Browsers
# dom-rtcrtptransceiver-direction

Browser compatibility

BCD tables only load in the browser

See also