【发布时间】:2019-08-29 13:27:19
【问题描述】:
我有一个基本的 webRTC 应用程序,它支持两个对等方之间的视频/音频通信和文件共享,当我在 Mozilla Firefox 上打开它时,该应用程序按预期运行,但当我在 Google Chrome 上运行它时,oniceccandidate 返回 null
我的 RTCPeerConnection
myConnection = new RTCPeerConnection();
建立对等连接
myConnection.createOffer().then(offer => {
currentoffer = offer
myConnection.setLocalDescription(offer);
})
.then(function () {
myConnection.onicecandidate = function (event) {
console.log(event.candidate);
if (event.candidate) {
send({
type: "candidate",
candidate: event.candidate
});
}
};
send({
type: "offer",
offer: currentoffer
});
})
.catch(function (reason) {
alert("Problem with creating offer. " + reason);
});
在 Mozilla Firefox 上,您可以在控制台日志中看到在每个“oniceccandidate”事件中收集的所有 ICE 候选者
在 Chrome 上,输出为空
【问题讨论】:
-
我遇到了同样的问题,你找到解决办法了吗?
标签: javascript google-chrome firefox webrtc