MediaRecorder:从多个麦克风录制 [英] MediaRecorder: Record from Multiple Microphones

查看:326
本文介绍了MediaRecorder:从多个麦克风录制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 MediaRecorder API来录制音频在应用程序内部.

I am currently using the MediaRecorder API to record audio inside an application.

是否可以通过多个输入设备(例如,两个麦克风)进行录音?

Is there a way to record from multiple input devices, say, two microphones?

我可以使用mediaDevices.enumerateDevices()获取设备列表,如这里.

I can get a list of devices using mediaDevices.enumerateDevices(), as demonstrated here.

理想情况下,如果可能的话,我想选择两个或多个要记录的设备.

Ideally, if possible, I would like to select two or more devices to be recorded.

这可能吗?

推荐答案

此功能会将您的曲目合并为一个:

this function will merge your tracks into one:

function mix(audioContext, streams) {
  const dest = audioContext.createMediaStreamDestination();
  streams.forEach(stream => {
    const source = audioContext.createMediaStreamSource(stream);
    source.connect(dest);
  });
  return dest.stream.getTracks()[0];
}

这篇关于MediaRecorder:从多个麦克风录制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆