Overview
RTPTransceiver represents a combination of an RTPSender and an RTPReceiver that share a common mid. It manages the bidirectional flow of media data in a WebRTC connection.Type Definition
Methods
SetCodecPreferences
Sets the preferred list of supported codecs. If codecs is empty or nil, resets to default from MediaEngine.[]RTPCodecParameters
List of codec parameters to set as preferences. Pass empty slice or nil to reset to defaults.
error
Returns error if codec is not supported by the MediaEngine
Sender
Returns the RTPTransceiver’s RTPSender if it has one.*RTPSender
The associated RTPSender, or nil if none exists
SetSender
Sets the RTPSender and Track to the current transceiver.*RTPSender
required
The RTPSender to associate with this transceiver
TrackLocal
required
The local track to send
Receiver
Returns the RTPTransceiver’s RTPReceiver if it has one.*RTPReceiver
The associated RTPReceiver, or nil if none exists
SetMid
Sets the RTPTransceiver’s mid. If it was already set, returns an error.string
required
The media ID to set for this transceiver
error
Returns error if mid is already set
Mid
Gets the Transceiver’s mid value. When not already set, this value will be set in CreateOffer or CreateAnswer.string
The media ID, or empty string if not yet set
Kind
Returns the RTPTransceiver’s kind (audio or video).RTPCodecType
The codec type (RTPCodecTypeAudio or RTPCodecTypeVideo)
Direction
Returns the RTPTransceiver’s current direction.RTPTransceiverDirection
The current direction (sendrecv, sendonly, recvonly, or inactive)
Stop
Irreversibly stops the RTPTransceiver.error
Returns error if stopping the sender or receiver fails
After calling Stop(), the transceiver’s direction is set to inactive and cannot be changed.
Usage Examples
Creating and Configuring a Transceiver
Setting Codec Preferences
Accessing Sender and Receiver
See Also
- RTPSender - Manages outbound RTP streams
- RTPReceiver - Manages inbound RTP streams
- TrackLocal - Local media track interface
- TrackRemote - Remote media track