iceRestart
特性为
RTCOfferOptions
dictionary is a Boolean value which, when
true
, tells the
RTCPeerConnection
to start ICE renegotiation.
注意:
Rather than manually creating and submitting an offer with
iceRestart
设为
true
, you should consider calling the
RTCPeerConnection
方法
restartIce()
代替。
var options = {
iceRestart: trueOrFalse
};
A Boolean value indicating whether or not the
RTCPeerConnection
should generate new values for the connection's ice-ufrag and ice-pwd values, which will trigger ICE renegotiation on the next message sent to the remote peer.
当
RTCPeerConnection
object's ICE connection state changes to
failed
, you should try to trigger an
ICE restart
. You should ideally do this by calling the
RTCPeerConnection
's
restartIce()
method, if it's available.
Fundamentally, this renegotiation is triggered by generating and using new values for the ICE username fragment ("ufrag")}}
This example shows a handler for the
iceconnectionstatechange
event. It watches for the ICE connection state to transition to
"failed"
, which indicates that an ICE restart should be tried in order to attempt to bring the connection back up.
pc.oniceconnectionstatechange = function(evt) {
if (pc.iceConnectionState === "failed") {
if (pc.restartIce) {
pc.restartIce();
} else {
pc.createOffer({ iceRestart: true })
.then(pc.setLocalDescription)
.then(sendOfferToServer);
}
}
}
If the state changes to
failed
, this handler starts by looking to see if the
RTCPeerConnection
includes the
restartIce()
method; if it does, we call that to request an ICE restart. Otherwise, we call back to the older technique: we manually create a new offer with
iceRestart
设为
true
, then that offer is set as the new local description for the connection. After that, the offer is sent to the server by calling a custom function
sendOfferToServer()
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCOfferOptions.iceRestart' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
iceRestart
|
Chrome 50 | Edge ≤79 | Firefox 48 | IE No | Opera ? | Safari ? | WebView Android 50 | Chrome Android 50 | Firefox Android 48 | Opera Android ? | Safari iOS ? | Samsung Internet Android 5.0 |
完整支持
不支持
兼容性未知
RTCOfferOptions
iceRestart
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDataChannelEvent
RTCDtlsTransport
RTCErrorEvent
RTCIceCandidate
RTCIceTransport
RTCPeerConnection
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpSender
RTCRtpTransceiver
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCStatsReport
RTCTrackEvent