stop() 方法在 RTCRtpTransceiver interface permanently stops the transceiver by stopping both the associated RTCRtpSender and RTCRtpReceiver .

注意: Until recently, the stopped property was provided to return true if the connection is stopped. That property has been deprecated and will be removed at some point. Instead, check the value of currentDirection . If it's stopped , the transceiver has been stopped.

This method does nothing if the transceiver is already stopped.

句法

RTCRtpTransceiver.stop()
					

Paramters

None.

返回值

undefined

异常

InvalidStateError
RTCPeerConnection of which the transceiver is a member is closed.

用法注意事项

当调用 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 track is stopped, and the transceiver's direction is changed to stopped , and renegotiation is triggered by sending a negotiationneeded event to the RTCPeerConnection .

The negotiation process causes currentNegotiation to be set to stopped , finally indicating that the transceiver has been fully stopped.

注意: Stopping the transceiver causes a negotiationneeded event to be sent to the transceiver's RTCPeerConnection , so the connection can adapt to the change.

规范

规范 状态 注释
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCRtpTransceiver.stop()' in that specification.
候选推荐

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
stop() Chrome 不支持 No Edge 不支持 No Firefox 59 IE 不支持 No Opera 不支持 No Safari Yes WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 59 Opera Android 不支持 No Safari iOS Yes Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: