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()
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. |
候选推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
不支持
RTCRtpTransceiver
setCodecPreferences()
stop()
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDataChannelEvent
RTCDtlsTransport
RTCErrorEvent
RTCIceCandidate
RTCIceTransport
RTCPeerConnection
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpSender
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCStatsReport
RTCTrackEvent