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

RTCRtpTransceiver: currentDirection property

· 52CE 我爱测

The read-only RTCRtpTransceiver property **`currentDirection`** is a string which indicates the current negotiated directionality of the transceiver.

WebRTC

The read-only RTCRtpTransceiver property currentDirection is a string which indicates the current negotiated directionality of the transceiver.

The directionality indicates whether the transceiver will offer to send and/or receive RTP data, or whether it is inactive or stopped and won't send or receive data.

The transceiver's preferred directionality can be set and read using the RTCRtpTransceiver.direction property. Changing the direction triggers a renegotiation, which may eventually result in the currentDirection also changing.

Value

The value is initially null, prior to negotiation using an offer/answer.

After negotiation the value is a string with one of the following values:

  • "sendrecv"
    • : Transceiver offers to send and receive RTP data:
      • RTCRtpSender: Offers to send RTP data, and will do so if the remote peer accepts the connection and at least one of the sender's encodings is active.
      • RTCRtpReceiver: Offers to receive RTP data, and does so if the remote peer accepts.
  • "sendonly"
    • : Transceiver offers to send but not receive RTP data:
      • RTCRtpSender: Offers to send RTP data, and will do so if the remote peer accepts the connection and at least one of the sender's encodings is active.
      • RTCRtpReceiver: Does not offer to receive RTP data and will not do so.
  • "recvonly"
    • : Transceiver offers to receive but not set RTP data:
      • RTCRtpSender: Does not offer to send RTP data, and will not do so.
      • RTCRtpReceiver: Offers to receive RTP data, and will do so if the remote peer offers.
  • "inactive"
    • : Transceiver is inactive:
      • RTCRtpSender: Does not offer to send RTP data, and will not do so.
      • RTCRtpReceiver: Does not offer to receive RTP data and will not do so.
  • "stopped"
    • : This is the terminal state of the transceiver. The transceiver is stopped and will not send or receive RTP data or offer to do so.
      • RTCRtpSender: Does not offer to send RTP data, and will not do so.
      • RTCRtpReceiver: Does not offer to receive RTP data and will not do so.

Specifications

Browser compatibility

See also

  • RTCRtpTransceiver.direction

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

资料来源与适用范围

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

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

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