refac: call overlay styling

This commit is contained in:
Timothy J. Baek
2024-08-23 16:42:36 +02:00
parent 4519ddd0e9
commit 48503573c1
5 changed files with 336 additions and 319 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import { toast } from 'svelte-sonner';
import { onMount, tick, getContext } from 'svelte';
import { onMount, tick, getContext, createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
import {
type Model,
@@ -762,10 +763,14 @@
}
// check if user has access to getUserMedia
try {
await navigator.mediaDevices.getUserMedia({ audio: true });
let stream = await navigator.mediaDevices.getUserMedia({ audio: true });
// If the user grants the permission, proceed to show the call overlay
stream.getTracks().forEach((track) => track.stop());
stream = null;
showCallOverlay.set(true);
dispatch('call');
} catch (err) {
// If the user denies the permission or an error occurs, show an error message
toast.error($i18n.t('Permission denied when accessing media devices'));