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

RTCRtpTransceiver: stop() method

· 52CE 我爱测

The **`stop()`** method in the RTCRtpTransceiver interface permanently stops the transceiver by stopping both the associated RTCRtpSender and RTCRtpReceiver.

WebRTC

The stop() method in the RTCRtpTransceiver interface permanently stops the transceiver by stopping both the associated RTCRtpSender and RTCRtpReceiver.

Syntax

stop()

Parameters

None.

Return value

None (undefined).

Exceptions

  • InvalidStateError DOMException
    • : Thrown if the RTCPeerConnection, of which the transceiver is a member, is closed.

Description

When you call stop() on a transceiver, the sender immediately stops sending media and each of its RTP streams are closed using the RTCP "BYE" message. The receiver then stops receiving media; the receiver's RTCRtpReceiver.track is stopped, and the transceiver's RTCRtpTransceiver.direction is changed to stopped. Renegotiation is triggered by sending a RTCPeerConnection.negotiationneeded_event event to the transceiver's RTCPeerConnection, so that the connection can adapt to the change.

The method does nothing if the transceiver is already stopped. You can check whether it has stopped by comparing RTCRtpTransceiver.currentDirection to "stopped".

[!NOTE] Earlier versions of the specification used the deprecated RTCRtpTransceiver.stopped property to indicate if the transceiver has stopped.

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

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

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