更新时间:2022-11-02 23:06:16
不要使用 null
调用 pc.addStream
.相反,只是不要调用它.
Don't call pc.addStream
with null
. Instead, just don't call it.
您需要指定这些 RTCOfferOptions 到 createOffer代码>:
You need to specify these RTCOfferOptions to createOffer
:
{ offerToReceiveVideo: true, offerToReceiveAudio: true }
原因是默认情况下,提供者只提供接收它正在发送的相同类型的流.我知道,这是一个愚蠢的默认值,但它给了报价者更多的控制权.从好的方面来说,始终指定这些选项并没有什么坏处,前提是它们符合您想要的行为.
The reason is that by default, the offerer only offers to receive the same kinds of streams it is sending. I know, a dumb default, but it gives the offerer a bit more control. On the upside, there's no harm in always specifying these options, if it matches your desired behavior.