【问题标题】:What WebRTC constraints and options should i pass to get interoperability between Firefox and Google chrome我应该通过哪些 WebRTC 约束和选项来获得 Firefox 和 Google chrome 之间的互操作性
【发布时间】:2014-07-31 06:42:26
【问题描述】:

我正在为 LAN 构建一个聊天应用程序。我使用 WebRTC,但无法让 Firefox 和 Google chrome 进行互操作。 我不知道应该传递给 RTCPeerConnection createOffer/createAnswer 的确切参数。

我在同一台计算机 Fedora Linux 20 上使用 Firefox 31Google Chrome 36 进行了以下测试

RTCPeerConnection 的创建方式如下: pc = new RTCPeerConnection(null, RTC_PC_OPTIONS);

答案/报价的创建方式如下: pc.createOffer(onsuccess, onfail, CONSTRAINTS);

我的问题是:我应该传递哪些参数(RTC_PC_OPTIONSCONSTRAINTS)以获得两个浏览器之间的互操作性?

测试 1

RTC_PC_OPTIONS = undefined
CONSTRAINTS = undefined

                        FFx2FFx     FFx2Chrome      Chrome2FFx      Chrome2Chrome
                        -------     ----------      ----------      -------------
dataChannel setup       ok          ok              ok              ok
dataChannel send/recv   ok          ok              ok              ok
Video stream            ok          ok              err [1]         ok

测试 2

MDN recomands this value for RTC_PC_OPTIONS

RTC_PC_OPTIONS = {
    optional: [
        {DtlsSrtpKeyAgreement: true},
        {RtpDataChannels: true}
    ]
};
CONSTRAINTS = undefined

                        FFx2FFx     FFx2Chrome      Chrome2FFx      Chrome2Chrome
                        -------     ----------      ----------      -------------
dataChannel setup       ok          err [2]         err [3]         ok
dataChannel send/recv   ok          -               -               ok
Video stream            ok          -               -               err [4]
                                    ^~~~~~~~~~~~~~~~^ 
                                            ^
                   i used datachannel to do signaling for the video TRCPeerConnection,
                   that is why these were not tested

测试 3

RTC_PC_OPTIONS = undefined
CONSTRAINTS = { 'mandatory': { 'OfferToReceiveAudio': true, 'OfferToReceiveVideo': true } }

                        FFx2FFx     FFx2Chrome      Chrome2FFx      Chrome2Chrome
                        -------     ----------      ----------      -------------
dataChannel setup       ok          ok              ok              err [5]
dataChannel send/recv   ok          ok              ok              -
Video stream            err [6]     ok              err [6]         -

  1. Chrome 创建报价并将其发送给 FFx,FFx 接收报价,创建答案并将其发送给 chrome,

chrome 收到了答案。但是在firefox中不会触发onaddstream


  1. chrome收到FFx发送的offer后,在控制台记录错误:

Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data send codecs..


  1. Chrome 发送报价,FFx 发送答案,

chrome 收到此错误:Failed to parse SessionDescription. m=application 35224 RTP/SAVPF Expects at least 4 fields.

FFx 收到此错误:ICE failed, see about:webrtc for more details

about:webrtc:

Local candidate Remote candidate ICE State Priority Nominated Selected a.b.c.d:35224/udp(host) a.b.c.d:45895/udp(host) frozen 9115005270282354000


  1. Chrome_1 收到错误:Uncaught NetworkError: Failed to execute 'send' on 'RTCDataChannel': Could not send data

chrome_2 得到错误:

Uncaught SyntaxError: Failed to execute 'addIceCandidate' on 'RTCPeerConnection': The ICE candidate could not be added.


  1. 调用者发送offer,被调用者报错:

Failed to set remote offer sdp: Session error code: ERROR_CONTENT. Session error description: Failed to set data send codecs.


  1. 喜欢 [1] 一切正常,但 onaddstream 未触发

【问题讨论】:

    标签: google-chrome firefox webrtc


    【解决方案1】:

    所以,有几件事:

    1. 无论 MDN 页面表明 RTPDataChannels 都非常过时(让我知道 URL)。 Firefox 和 Chrome 现在都支持规范 DataChannels。我相信 DTLSSRTPKeyAgreement 也是如此
    2. 确保在 createOffer() 之前调用 createDataChannel()
    3. 是纯视频还是视频+音频?如果我记得没有触发 onAddStream,我们最近修复了仅视频流的错误。我认为这可以解释1 和 [6]。见bug 1035067,登陆Nightly and Aurora (FF33);我已经要求升级到 Beta/32
    4. “预计 4 个字段”问题,如果我记得是 Firefox 中的错误 - 您正在运行什么版本?我们确实在 30(?) 中修复了一个错误,我们在末尾有一个不需要的空间,导致 chrome 拒绝它 - 他们修补以避免它,我们修复了它。

    用 FF Beta 和 Nightly (http://nightly.mozilla.org/) 试试。当您报告此类情况时,请说明您使用的浏览器版本! :-)

    【讨论】:

    • 谢谢你这么匹配@jesup,1)这里是the mdn page(最后编辑于 3 月 8 日)。 2)是的,我愿意。 3)它只是视频和一种方式(只有一个对等方传输视频)。 4)我提到版本是FFX 31.0和Chrome 36。我应该用粗体写:-)我会用nightly试试看
    • 我刚刚在夜间使用 Firefox 进行了测试,一切都适用于 RTC_PC_OPTIONS = undefinedCONSTRAINTS = undefined。再次感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-16
    • 2013-06-08
    • 2014-05-04
    • 2010-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多