Skip to content

使用sourceStream设置双声道的流时仍然导出的是单声道音频 #256

Open
@hejie615

Description

已经设置了sourceStream为什么导出的时候倒是单声道音频还需要额外处理什么吗
let recorderNew: any = null;
export const recordStartNew = () => {
navigator.mediaDevices
.getUserMedia({
audio: {
channelCount: 2,
},
})
.then((stream) => {
const audioContext = new window.AudioContext();
const source = audioContext.createMediaStreamSource(stream);
// 创建双声道处理
const channelMerger = audioContext.createChannelMerger(2);
source.connect(channelMerger);
channelMerger.connect(audioContext.destination);
recorderNew = RecorderNew({
type: "wav", // 录音格式,可以换成wav等其他格式
sampleRate: 48000, // 录音的采样率,越大细节越丰富越细腻
bitRate: 16, // 录音的比特率,越大音质越好
sourceStream: stream,
});
recorderNew.open(() => {
recorderNew.start();
});
// 成功回调,返回媒体流
})
.catch((error) => {
// 错误处理
});
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions