start recording without audio if permission is not granted
This commit is contained in:
parent
0b733c6f5c
commit
3930373a7a
1 changed files with 15 additions and 5 deletions
|
|
@ -62,12 +62,22 @@ export default function Recorder({ closeModal, step, setStep }: Props) {
|
|||
},
|
||||
});
|
||||
|
||||
const micStream = await navigator.mediaDevices.getUserMedia({
|
||||
audio: { deviceId: selectedDevice?.deviceId },
|
||||
});
|
||||
let micStream;
|
||||
try {
|
||||
micStream = await navigator.mediaDevices.getUserMedia({
|
||||
audio: { deviceId: selectedDevice?.deviceId },
|
||||
});
|
||||
} catch (error) {
|
||||
// Handle the case where microphone permissions are not granted
|
||||
console.error("Failed to access microphone:", error);
|
||||
}
|
||||
|
||||
const mediaStream = new MediaStream();
|
||||
micStream.getAudioTracks().forEach((track) => mediaStream.addTrack(track));
|
||||
if (micStream) {
|
||||
micStream
|
||||
.getAudioTracks()
|
||||
.forEach((track) => mediaStream.addTrack(track));
|
||||
}
|
||||
screenStream
|
||||
.getVideoTracks()
|
||||
.forEach((track) => mediaStream.addTrack(track));
|
||||
|
|
@ -373,7 +383,7 @@ export default function Recorder({ closeModal, step, setStep }: Props) {
|
|||
{submitting ? (
|
||||
<>
|
||||
<svg
|
||||
className="animate-spin -ml-1 mr-3 h-5 w-5 text-white"
|
||||
className="-ml-1 mr-3 h-5 w-5 animate-spin text-white"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
|
|
|
|||
Loading…
Reference in a new issue