我正在使用Angular 7和WebRTC构建新的应用程序,并且我使用recordRTC.js来录制(音频和视频)我的问题是当我录制多个流时,只录制第一个流的音频。
public addStreamToRecorder(stream: MediaStream)
{
if (!this.recorder)
{
this.recorder = RecordRTC([stream],{type: "video"});
this.recorder.startRecording();
}
else
{
this.recorder.getInternalRecorder().addStreams([stream]);
}
}经过调查,我发现appendStreams在reocrdrtc中的功能不能混音。
发布于 2019-10-03 17:10:54
我用我从MultiStreamRecorder (https://github.com/streamproc/MediaStreamRecorder)得到的最新版本更新了recordRTC中的appendStreams函数,修复了这个问题。
将recordRTC中的appendStreams替换为
this.appendStreams = function (streams) {
if (!streams) {
throw 'First parameter is required.';
}
if (!(streams instanceof Array)) {
streams = [streams];
}
arrayOfMediaStreams.concat(streams);
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 && this.audioContext) {
var audioSource = this.audioContext.createMediaStreamSource(stream);
audioSource.connect(this.audioDestination);
self.audioSources.push(audioSource);
}
});
};https://stackoverflow.com/questions/58166881
复制相似问题