我应该通过哪些WebRTC约束和选项来获得Firefox和Google Chrome之间的互操作性

naw*_*bgh 10 firefox google-chrome webrtc

我正在为局域网构建聊天应用程序.我使用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
Run Code Online (Sandbox Code Playgroud)

测试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
Run Code Online (Sandbox Code Playgroud)

测试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]         -
Run Code Online (Sandbox Code Playgroud)
  1. Chrome创建商品并将其发送到FFx,FFx收到商品,创建答案并将其发送到Chrome,

chrome得到答案.但onaddstream并没有在firefox中被触发


  1. 在chrome收到FFx发送的报价后,它会向控制台记录错误:

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. 调用者发送提议,被调用者收到错误:

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


  1. 像[1]一切都好,但onaddstream没有触发

jes*_*sup 5

所以,有一些事情:

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

尝试使用FF Beta和Nightly(http://nightly.mozilla.org/).当您报告此类内容时,请指出您正在使用的浏览器版本!:-)