繁体   English   中英

Webrtc:无法处理WebRTC答案

[英]Webrtc: Could not process WebRTC answer

我使用ejabberd + stanza io构建实时消息和音频呼叫网站。 我设法进行了第一次音频通话

from chrome(on PC) -> chrome(on mac) with no errors

当我尝试拨打电话时会出现问题

from chrome(on mac) to firefox(on pc) or vice versa

Chrome浏览器日志显示Could not process WebRTC answer

通过使用chrome://webrtc-internals调试工具我发现setremotedescription失败并出现错误:

`Failed to set remote answer sdp: Called with SDP without ice-ufrag and ice-pwd`

这就是我用来开始通话的内容:

var session = client.jingle.createMediaSession('full JID');
  session.addStream(localAudio_stream); // getUserMedia stream
  session.start();

我究竟做错了什么? firefox如何成功建立一个调用但是chrome cant(在opera上测试得到相同的结果(失败))

完整的JS代码

我已经通过在client.js(stanza.io)中包含npm包sdpparser然后再次构建它来解决了这个问题,并且在stanza.io.bundle中调整了PeerConnection.prototype.handleAnswer如下所示:

var sdp = client.SdpParser.parse(answer.sdp);
sdp.media.forEach(function(media){
  if(media.type === 'video' && media.inactive ) {
    delete media.fingerprint;
    media.port = 0;
  }
});
answer.sdp = client.SdpParser.format(sdp);

这可能不是最好的方法,但它肯定解决了这个问题。

调整后的stanza.io的github链接

jingle.js repo上有用的github问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM