The "options" in "peer.call(id, stream, options) " should be documented.
I saw the #126 before, but i think there is something meaningful in the peerconnection's options. Because some problem confuses me when i tried to call the other peer with the audio only, i cannot received the video from that peer. After I search the google, I found that this situation happened because I don't set the OfferToReceiveVideo to true, in webrtc constraints, it means if a caller only has the audio stream, the OfferToReceiveVideo is setting to false, even if the the callee answer a video stream, we won't received it.
As soon as I set it like this:
var options = {
'constraints': {
'mandatory': {
'OfferToReceiveAudio': true,
'OfferToReceiveVideo': true
}
}
}
var call = peer.call(otherPeer, callStream, options);
It finally works.
So I suggest that maybe we could document it in the Docs, or just set it as the default in the source code.
I experienced the same thing today. Documentation needs to be updated.
Thanks, will do!
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer
Note: You shouldn't use this legacy property. Instead, use RTCRtpTransceiver to control whether or not to accept incoming video.
@afrokick Do you have an example of using RTCRtpTransceiver for this? I'm confused as to how it would be implemented with Peer.JS. I'm having a fairly common issue -- Users with video disabled should still be able to participate -- but when I connect that media stream, the users who only have audio can also only recieve audio.
@afrokick Can you please provide an example of this being solved with RTCRtpTransceiver? I have the same issue as the others, sending audio, can not receiving video.
Thank you for explaining. this is very helpfull
@afrokick I am using PeerJS and facing the same issue, If I tried to call some peer with the only audio stream, I cannot receive the video from that peer. I am confused on how to use the below options in Peer.js
'OfferToReceiveAudio': true,
'OfferToReceiveVideo': true
Could you please refer to this and help me out here.
var constraints = {
'mandatory': {
'OfferToReceiveAudio': true,
'OfferToReceiveVideo': true
},
offerToReceiveAudio: 1,
offerToReceiveVideo: 1,
}
You shoud name your object like "constraints" and then: var call = peer.call(otherPeer, callStream, constraints);
Thanks @TomaszRzucidlo
var options = {
'constraints': {
'mandatory': {
'OfferToReceiveAudio': true,
'OfferToReceiveVideo': true
},
offerToReceiveAudio: 1,
offerToReceiveVideo: 1,
}
}
I initialized variable options as shown above and used it as below and it worked:
var call = peer.call(otherPeer, callStream, options);
Hi @TomaszRzucidlo,
On Typescript ( Angular ) those parameters was not available for me 🤕
"STEP UP"
"peerjs": "^1.2.0",
"angular":9

Did you know how to create a blank MediaStream as response for those who not accept their camera and microphone to setting up the peer to peer communication. ✨
I really sorry for the misconception of WebRTC 😢
Thank-you
With constraints it works! Thanks you save my life! Please add to Docs!
Hi @TomaszRzucidlo, On Typescript ( Angular ) those parameters was not available for me 🤕 "STEP UP" "peerjs": "^1.2.0", "angular":9
Did you know how to create a blank MediaStream as response for those who not accept their camera and microphone to setting up the peer to peer communication. ✨
I really sorry for the misconception of WebRTC 😢
Thank-you
Do u find a answer for it?
I resolve it doing this: Typescript not nag
const options = {
constraints: {
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true,
},
offerToReceiveAudio: 1,
offerToReceiveVideo: 1,
},
sdpTransform: (sdp: string) => {
return sdp.replace(
'a=fmtp:111 minptime=10;useinbandfec=1',
'a=fmtp:111 ptime=5;useinbandfec=1;stereo=1;maxplaybackrate=48000;maxaveragebitrat=128000;sprop-stereo=1',
)
},
}
const call = me.call(peerId, stream, options)
Ignore sdp. If didnt work, just try add "as any" in options