This commit is contained in:
Timothy Jaeryang Baek 2025-05-05 11:25:00 +04:00
parent 9e1400f055
commit eec7a2afa1
2 changed files with 25 additions and 2 deletions

View File

@ -239,7 +239,16 @@
audioChunks = []; audioChunks = [];
recording = false; recording = false;
}; };
mediaRecorder.start();
try {
mediaRecorder.start();
} catch (error) {
console.error('Error starting recording:', error);
toast.error($i18n.t('Error starting recording.'));
loading = false;
recording = false;
return;
}
if (transcribe) { if (transcribe) {
if ($config.audio.stt.engine === 'web' || ($settings?.audio?.stt?.engine ?? '') === 'web') { if ($config.audio.stt.engine === 'web' || ($settings?.audio?.stt?.engine ?? '') === 'web') {

View File

@ -22,7 +22,21 @@
{#if token.type === 'html'} {#if token.type === 'html'}
{#if html && html.includes('<video')} {#if html && html.includes('<video')}
{@html html} {@const video = html.match(/<video[^>]*>([\s\S]*?)<\/video>/)}
{@const videoSrc = video && video[1]}
{#if videoSrc}
<!-- svelte-ignore a11y-media-has-caption -->
<video
class="w-full my-2"
src={videoSrc}
title="Video player"
frameborder="0"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
></video>
{:else}
{token.text}
{/if}
{:else if token.text && token.text.match(/<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/)} {:else if token.text && token.text.match(/<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/)}
{@const match = token.text.match( {@const match = token.text.match(
/<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/ /<iframe\s+[^>]*src="https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?[^"]*)?"[^>]*><\/iframe>/