{#if loading}
{/if}
{#if voiceInput}
{ voiceInput = false; }} on:confirm={(e) => { const { text, filename } = e.detail; // url is hostname + /cache/audio/transcription/ + filename const url = `${window.location.origin}/cache/audio/transcription/${filename}`; // Open in new tab if (content.trim() !== '') { content = `${content}\n\n${text}\n\nRecording: ${url}\n\n`; } else { content = `${content}${text}\n\nRecording: ${url}\n\n`; } voiceInput = false; }} />
{:else}
{ try { let stream = await navigator.mediaDevices .getUserMedia({ audio: true }) .catch(function (err) { toast.error( $i18n.t(`Permission denied when accessing microphone: {{error}}`, { error: err }) ); return null; }); if (stream) { voiceInput = true; const tracks = stream.getTracks(); tracks.forEach((track) => track.stop()); } stream = null; } catch { toast.error($i18n.t('Permission denied when accessing microphone')); } }} >
{/if}