Reputation: 350
I'm using peerjs to implement a video conference application, the thing is that I want clients to connect even if they don't have mic or camera, when I get the user media I check if they have available devices, when they don't have any or if they block the devices I try to fallback to an empty MediaStream, but when I try to connect two peers the behavior of the connection only works as intended when the initiator has a conventional stream product of calling getUserMedia, if the initiator has an empty MediaStream things just don't work at all.
Upvotes: 0
Views: 1159
Reputation: 591
the OfferToReceiveAudio
and OfferToReceiveVideo
options of webrtc should allow you to create a recv only peerconnection .
here a reference in peerjs code: https://github.com/peers/peerjs/blob/cfc37c7988d8ef3d2c1d7b6123562dd2af59defc/test/peer.ts#L63
For recent browser and with webrtc native api you have to add Transceiver
with direction set to recvonly:
peerConnection.addTransceiver('audio', {
direction: 'recvonly',
});
I don't know how to do that with peerJs
Upvotes: 5