问题描述
我想知道我做错了什么。
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 });
任何想法?
推荐答案
根据最新的,约束的正确形式参数应为:
According to the newest Webrtc spec the correct form of the constraint parameter should be:
{ offerToReceiveAudio: true, offerToReceiveVideo: true }
请注意开头的小写'o'来自offerToReceiveAudio
和 offerToReceiveVideo
。
目前只支持FF 33或更高版本。
This is currently supported only by FF 33 or newer.
Chrome仅支持自己的方式:
Chrome supports only the own way:
{ mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true } }
如果你给它一个具有新规格结构的约束对象,Chrome会抛出错误。
Chrome will throw and error if you give it a constraint object that has a structure according to the new spec.
好消息是Firefox仍然接受旧表格。在这种情况下,它只会打印一条警告消息。所以,至少现在,使用旧版本。
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.
这篇关于WebRTC - 从Chrome获取“格式错误的约束对象”,而不是Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!