direction is a string which indicates the transceiver's preferred directionality. Its value must be one of the strings defined by the
The transceiver's current direction is indicated by the
var direction = RTCRtpTransceiver.direction
DOMString whose value is one of the strings which are a member of the
RTCRtpTransceiverDirection enumerated type, indicating the transceiver's preferred direction.
||Offers to send RTP data, and will do so if the other peer accepts the connection and at least one of the sender's encodings is active1.||Offers to receive RTP data, and does so if the other peer accepts.|
||Offers to send RTP data, and will do so if the other peer accepts the connection and at least one of the sender's encodings is active1.||Does not offer to receive RTP data and will not do so.|
||Does not offer to send RTP data, and will not do so.||Offers to receive RTP data, and will do so if the other peer offers.|
||Does not offer to send RTP data, and will not do so.||Does not offer to receive RTP data and will not do so.|
 To determine if a sender has at least one active encoding, the user agent gets its parameters using
RTCRtpSender.getParameters(), then looks at the parameters'
encodings property; if any of the listed encodings has its
active property set to
true, the sender has an active encoding.
When setting the value of
direction, the following exceptions can occur:
- Either the receiver's
RTCPeerConnectionis closed or the
Setting the direction
When you change the value of
InvalidStateError exception will occur if the connection is closed or the receiver is stopped.
Effect on offers and answers
The value of
direction is used by
RTCPeerConnection.createAnswer() 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:
|WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCRtpTransceiver.direction' in that specification.