大网数据广告活动
Web 标准与前端开发

RTCRtpTransceiver

· 52CE 我爱测

The WebRTC interface **`RTCRtpTransceiver`** describes a permanent pairing of an RTCRtpSender and an RTCRtpReceiver, along with some shared state.

WebRTC

The WebRTC interface RTCRtpTransceiver describes a permanent pairing of an RTCRtpSender and an RTCRtpReceiver, along with some shared state.

Each SDP media section describes one bidirectional SRTP ("Secure Real Time Protocol") stream (excepting the media section for RTCDataChannel, if present). This pairing of send and receive SRTP streams is significant for some applications, so RTCRtpTransceiver is used to represent this pairing, along with other important state from the media section. Each non-disabled SRTP media section is always represented by exactly one transceiver.

A transceiver is uniquely identified using its RTCRtpTransceiver.mid property, which is the same as the media ID (mid) of its corresponding m-line. An RTCRtpTransceiver is associated with an m-line if its mid is non-null; otherwise it's considered disassociated.

Instance properties

  • RTCRtpTransceiver.currentDirection
    • : A read-only string which indicates the transceiver's current negotiated directionality, or null if the transceiver has never participated in an exchange of offers and answers. To change the transceiver's directionality, set the value of the RTCRtpTransceiver.direction property.
  • RTCRtpTransceiver.direction
    • : A string which is used to set the transceiver's desired direction.
  • RTCRtpTransceiver.mid
    • : The media ID of the m-line associated with this transceiver. This association is established, when possible, whenever either a local or remote description is applied. This field is null before a description containing the corresponding m-line is applied, or if a rollback undoes that association.
  • RTCRtpTransceiver.receiver
    • : The RTCRtpReceiver object that handles receiving and decoding incoming media.
  • RTCRtpTransceiver.sender
    • : The RTCRtpSender object responsible for encoding and sending data to the remote peer.
  • RTCRtpTransceiver.stopped
    • : Indicates whether or not sending and receiving using the paired RTCRtpSender and RTCRtpReceiver has been permanently disabled, either due to SDP offer/answer, or due to a call to RTCRtpTransceiver.stop.

Instance methods

  • RTCRtpTransceiver.setCodecPreferences
    • : Configures the transceiver's preferred list of codecs, overriding user agent settings.
  • RTCRtpTransceiver.stop
    • : Permanently stops the RTCRtpTransceiver. The associated sender stops sending data, and the associated receiver likewise stops receiving and decoding incoming data.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。