hi i am working with a webrtc project . i am using Recordrtc for recording both localstream and remotestream
recorder = RecordRTC([localstream,remotestream], {
type: 'video',
mimeType: 'video/webm',
numberOfAudioChannels: 2,
elementClass: 'multi-streams-mixer',
audioBitsPerSecond: 6000, // min: 100bps max: 25000
videoBitsPerSecond: 150000, // min: -5000bps max: 130000
});
on flip my camera i will update the recorder with new stream
recorder.getInternalRecorder().resetVideoStreams([localStream, remoteStream]);
on reseting new stream i loose audio of remote stream . can any one help me solve the audio issue
I fixed this issue by updating resetVideoStreams function in recordRTC with latest version
replace resetVideoStreams in recordRTC with
function resetVideoStreams(streams) {
videos = [];
streams = streams || arrayOfMediaStreams;
// via: @adrian-ber
streams.forEach(stream => {
if (stream.getTracks().filter(function (t) {
return t.kind === 'video';
}).length) {
var video = getVideo(stream);
video.stream = stream;
videos.push(video);
}
if (stream.getTracks().filter(function (t) {
return t.kind === 'audio';
}).length && self.audioContext) {
var audioSource = self.audioContext.createMediaStreamSource(stream);
audioSource.connect(self.audioDestination);
self.audioSources.push(audioSource);
}
});
}