fix/not asking for mic permissions (first time)

This commit is contained in:
MarconLP 2023-05-01 22:49:18 +02:00
parent 99d2c6f4d7
commit 0ddeda1f1c
No known key found for this signature in database
GPG key ID: A08A9C8B623F5EA5

View file

@ -135,6 +135,11 @@ export default function Recorder({ closeModal, step, setStep }: Props) {
useEffect(() => { useEffect(() => {
async function getAudioDevices() { async function getAudioDevices() {
try { try {
const stream = await navigator.mediaDevices.getUserMedia({
audio: { echoCancellation: false },
});
stream.getTracks().forEach((track) => track.stop()); // release the stream
const devices = await navigator.mediaDevices.enumerateDevices(); const devices = await navigator.mediaDevices.enumerateDevices();
const audioDevices = devices.filter( const audioDevices = devices.filter(
(device) => device.kind === "audioinput" (device) => device.kind === "audioinput"
@ -368,7 +373,7 @@ export default function Recorder({ closeModal, step, setStep }: Props) {
{submitting ? ( {submitting ? (
<> <>
<svg <svg
className="-ml-1 mr-3 h-5 w-5 animate-spin text-white" className="animate-spin -ml-1 mr-3 h-5 w-5 text-white"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
fill="none" fill="none"
viewBox="0 0 24 24" viewBox="0 0 24 24"