Javascript Firefox上的RTPeerConnection与RTCConfiguration中断
使用RTCConfiguration创建一个新的RTPeerConnection,如下面的代码,在Chrome 70和Safari 12中运行良好,但在Firefox 63中会中断Javascript Firefox上的RTPeerConnection与RTCConfiguration中断,javascript,typescript,firefox,websocket,webrtc,Javascript,Typescript,Firefox,Websocket,Webrtc,使用RTCConfiguration创建一个新的RTPeerConnection,如下面的代码,在Chrome 70和Safari 12中运行良好,但在Firefox 63中会中断 const configuration: RTCConfiguration = { iceServers: [ { urls: 'turn:user@myserver.com:3478', username: 'user', credential: 'myp
const configuration: RTCConfiguration = {
iceServers: [
{
urls: 'turn:user@myserver.com:3478',
username: 'user',
credential: 'mypwd'
}
]
};
let rtcPeerConn: RTCPeerConnection = new RTCPeerConnection(configuration);
我尝试了前缀
的rtpeerconnection
,但都不起作用,同样的错误
// as above configuration
const PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection || window.msRTCPeerConnection;
let RTCPeerConn = new PeerConnection(configuration);
然后我尝试添加WebRTC,但遇到了相同的错误
// as above configuration
const PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection || window.msRTCPeerConnection;
let RTCPeerConn = new PeerConnection(configuration);
最后我注意到,如果我删除了配置
aka,如果我没有将配置传递给构造函数,我不会遇到错误,但是如果我尝试使用setConfiguration
方法设置配置,我会遇到未知的函数异常
有什么想法吗?我的问题是重复的,我的问题的答案由@stefan peshikj在年给出 事实证明,Chrome和Safari比Firefox更宽容,Firefox不接受带有“username@”的turn url 不接受:
const configuration: RTCConfiguration = {
iceServers: [
{
urls: 'turn:user@myserver.com:3478', // <- here remove "user@"
username: 'user',
credential: 'mypwd'
}
]
};
这解决了我的问题。Thx@stefan peshikj,并非所有英雄都戴斗篷。如果你想在这里重写你的答案以获得你应得的业力点,请毫不犹豫地这样做我的问题是重复的,我的问题的答案由@stefan peshikj in给出 事实证明,Chrome和Safari比Firefox更宽容,Firefox不接受带有“username@”的turn url 不接受:
const configuration: RTCConfiguration = {
iceServers: [
{
urls: 'turn:user@myserver.com:3478', // <- here remove "user@"
username: 'user',
credential: 'mypwd'
}
]
};
这解决了我的问题。Thx@stefan peshikj,并非所有英雄都戴斗篷。如果你想在这里重写你的答案,以得到你应得的业力点,不要犹豫