录制优化

This commit is contained in:
yj 2024-08-19 13:47:02 +08:00
parent eee009ab9f
commit 70f15b2666
1 changed files with 8 additions and 4 deletions

View File

@ -624,10 +624,14 @@ const Meeting: React.FC = () => {
}
} as any
}).then(async (steam) => {
const audioTracks = await navigator.mediaDevices
.getUserMedia({ audio: true, video: false })
.then(audioStream => audioStream.getAudioTracks()[0]);
steam.addTrack(audioTracks);
try {
const audioTracks = await navigator.mediaDevices
.getUserMedia({ audio: true, video: false })
.then(audioStream => audioStream.getAudioTracks()[0]);
steam.addTrack(audioTracks);
} catch (error) {
}
setMediaStream(steam)
setRecorder(new MediaRecorder(steam))
})