在 resetstream 上记录 rtc 多流记录器松散的音频

record rtc multistream recorder loose audio on resetstream

您好,我正在处理一个 webrtc 项目。我正在使用 Recordrtc 来记录本地流和远程流

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
  });

翻转我的相机,我将用新流更新记录器

recorder.getInternalRecorder().resetVideoStreams([localStream, remoteStream]);

在重置新流时,我丢失了远程流的音频。谁能帮我解决音频问题

我通过使用最新版本更新 recordRTC 中的 resetVideoStreams 函数解决了这个问题

将 recordRTC 中的 resetVideoStreams 替换为

    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);
            }
        });

    }