I was able to do this by using Web Audio API. I fetched the audio tracks from both the streams and joined them into one using audio context.
var OutgoingAudioMediaStream = new MediaStream(); OutgoingAudioMediaStream.addTrack(OutgoingStream.getAudioTracks()); var IncomingAudioMediaStream = new MediaStream(); IncomingAudioMediaStream.addTrack(IncomingStream.getAudioTracks()); const audioContext = new AudioContext(); audioIn_01 = audioContext.createMediaStreamSource(OutgoingAudioMediaStream); audioIn_02 = audioContext.createMediaStreamSource(IncomingAudioMediaStream); dest = audioContext.createMediaStreamDestination(); audioIn_01.connect(dest); audioIn_02.connect(dest); var FinalStream = dest.stream;
This worked perfectly.
CLICK HERE to find out more related problems solutions.