I need to make one way webrtc communication. So a fake media stream from one way can be useful. So far I was not able to put a fake stream in RTCPeerConnection. Sending stream from both way works. I tried multiple ways. Can anyone tell me a good way to achieve this?
- Tried to get media devices with configuration all set to false. But at least one is required.
navigator.mediaDevices
.getUserMedia({
audio: false,
})
.then(getUserMediaSuccess)
.catch(errorHandler);
Tried to create fake media capture with canvas from here, but could not succeed.
Tried to add
new RTCPeerConnection().addTransceiver().receiver.track. But not sure what it is and how to use it properly.
function start(isCaller) {
//createMediaStreamFake();
peerConnection.current = new RTCPeerConnection(peerConnectionConfig);
peerConnection.current.onicecandidate = gotIceCandidate;
peerConnection.current.ontrack = gotRemoteStream;
//peerConnection.current.addStream(localStream.current);
peerConnection.current.addStream(
new RTCPeerConnection().addTransceiver().receiver.track
);
}