Experimental
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
当 RTCPeerConnection
通过RTCPeerConnection.setLocalDescription()
方法更改本地描述之后,该RTCPeerConnection
会抛出icecandidate
事件。该事件的监听器需要将更改后的描述信息传送给远端RTCPeerConnection
,以更新远端的备选源。
使用指南
icecandidate
的类型为 RTCPeerIceCandidateEvent
, 在以下三种情况下会触发该事件:
分享新的源
触发icecandidate
事件的首要原因:当获得新的源之后,需要将该源的信息发送给远端信号服务器,并分发至其他端的RTCPeerConnection
。其他RTCPeerConnection
通过addIceCandidate()
方法将新candidate
中携带的信息,将新的源描述信息添加进它的备选池中;
rtcPeerConnection.onicecandidate = (event) => { if (event.candidate) { sendCandidateToRemotePeer(event.candidate) } }
概述
- 规范
- WebRTC 1.0: Real-time Communication Between Browsers
icecandidate - 接口
RTCPeerConnectionIceEvent
- 事件冒泡
- 否
- 能否取消默认
- 否
- 事件目标
RTCPeerConnection
- 默认行为
- 无
属性
方法
方法继承自 RTCPeerConnectionIceEvent
.
相关事件
- 无
规范
规范 | 状态 | 注释 |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers icecandidate |
Candidate Recommendation |
兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
特性 | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | 未实现 | (Yes) | ? |
特性 | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | ? | ? | (Yes) | ? | 未实现 | ? | ? |