Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC - getting 'malformed constraints object' from Chrome but not Firefox

I wonder what I'm doing wrong.

I'm getting 'malformed constraints object' errors from this:

pc.createAnswer( function (answer) {
  ...
}, fail, { offerToReceiveAudio: true, offerToReceiveVideo: true });

Any ideas?

like image 765
Costa Michailidis Avatar asked Mar 17 '23 10:03

Costa Michailidis


1 Answers

According to the newest Webrtc spec the correct form of the constraint parameter should be:

{ offerToReceiveAudio: true, offerToReceiveVideo: true }

Note the lowercase 'o's at the beginnings of offerToReceiveAudio and offerToReceiveVideo.

This is currently supported only by FF 33 or newer.

Chrome supports only the own way:

{ mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true } }

Chrome will throw and error if you give it a constraint object that has a structure according to the new spec.

The good news is that Firefox still accepts the old form. It just prints a warning message in that case. So, at least for now, use the old version.

like image 62
Svetlin Mladenov Avatar answered Mar 23 '23 00:03

Svetlin Mladenov