1

I am using Chrome ans working on a webRTC application. I am getting an error 'malformed constraints object' in the createAnswer() for a session Description offer

pc.createAnswer(gotDescription, errorHandler, constraints);

I have tried all the options such as

constraints = {'mandatory': {
                'offerToReceiveAudio': true,
                'offerToReceiveVideo': true}};
constraints = {'offerToReceiveAudio': true,
           'offerToReceiveVideo': true};

and with both capital and small 'o' but still the same error.

Any suggestions?

St Koi
  • 13
  • 3
  • Possible duplicate of [WebRTC - getting 'malformed constraints object' from Chrome but not Firefox](https://stackoverflow.com/questions/27830810/webrtc-getting-malformed-constraints-object-from-chrome-but-not-firefox) – Frederic Leitenberger Aug 16 '18 at 18:56

1 Answers1

3

It seems in the latest Specs, the audio/video offers are not required any more in RTCOfferOptions, so you may omit that unless you want to specify the iceRestart option which default is false.

http://w3c.github.io/webrtc-pc/#idl-def-RTCOfferOptions

pc.createAnswer(gotDescription, errorHandler);
Gurpreet Sachdeva
  • 218
  • 1
  • 2
  • 8