4

I'm developing a simple example to test WebRTC, and I've found the following strange behaviour.

When using Chrome, the media constraints are specified as:

mediaConstraints = {'mandatory': {'OfferToReceiveAudio':true, 'OfferToReceiveVideo':true}};

which works fine.

However, when using Firefox (35.0.1 on the mac), according to the spec it should be:

mediaConstraints = {'offerToReceiveAudio':true,'offerToReceiveVideo':true};

But doesn't work (Ice failed!)

Using "OfferToReceiveAudio"

mediaConstraints = {'OfferToReceiveAudio':true,'offerToReceiveVideo':true};

works fine.

Is this documented behaviour?

Pavlo
  • 43,301
  • 14
  • 77
  • 113

2 Answers2

5

The right format (by now) is:

offerOptions = {'offerToReceiveAudio':true,'offerToReceiveVideo':true};

as this is the new spec format and is supported by both Chrome and Firefox.

Take special care to note the lower-case 'o's, as this did change and threw more than a few people. Hopefully you got it working by now.

Also note that these are no longer "constraints", just "options". Simpler.

jib
  • 40,579
  • 17
  • 100
  • 158
0

In the specs here:

https://developer.mozilla.org/en-US/docs/Web/Guide/API/WebRTC/WebRTC_basics

I see that the constraints should be in the following format:

var constraints = {
    mandatory: {
        OfferToReceiveAudio: true,
        OfferToReceiveVideo: true
    }
};

Chrome only supports that format.

you can refer to this discussion for same issue:

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

Community
  • 1
  • 1
Maxime Marchand
  • 351
  • 2
  • 12
  • 4
    Yes, that's the old way. The second one is the new way of the last spec, that Firefox implements, but not Chrome – Eduardo Sanchez Feb 04 '15 at 16:07
  • It is bizarre that you are getting this failing error. When I test I only see that OfferToReceiveAudio or OfferToReceiveVideo is deprecated and that I should be using offerToReceiveAudio or offerToReceiveVideo. The call does not fail in either case... – Maxime Marchand Feb 04 '15 at 22:49
  • Yes, the call does not fail, but later I got the message "Ice failed" (not associated to any concrete call) – Eduardo Sanchez Feb 05 '15 at 11:30
  • @MaximeMarchand - the information in the documentation link was outdated unfortunately and has recently been updated, at least in regard to RTCOfferOptions. – jib Jun 22 '15 at 14:22