Skip to content Skip to sidebar Skip to footer

Webrtc Datachannel: Working In Firefox But Not Chrome

I'm fairly new in WebRTC. I'm trying to establish a simple data channel between two peers, without audio nor video; just text data. At the end it's going to be a game where 2-7 pe

Solution 1:

Remove this:

pcOptions= { optional:  [
{DtlsSrtpKeyAgreement:true}, {RtpDataChannels:true }] 
},

It's old non-standard chrome stuff that does nothing in Firefox, but causes bats to fly out in Chrome. Data channels don't run over rtp, nor rely on srtp, in the spec.

While you're at it, remove this as well:

sdpOptions = {mandatory: {OfferToReceiveAudio: true,  OfferToReceiveVideo: false}};

The format has changed to (note the lower-case 'o's):

sdpOptions = { offerToReceiveAudio: true,  offerToReceiveVideo: false};

But it's unnecessary for just data channels. If it still doesn't work, let me know.

I also highly recommend adapter.js, the official WebRTC polyfill, which lets you use the latest spec with promises etc. like this. A shim more than a library, it aims to eventually disappear.

Post a Comment for "Webrtc Datachannel: Working In Firefox But Not Chrome"