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() 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: