Commit f92ef321 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

refac: permission

parent 508e8eb4
...@@ -896,11 +896,20 @@ ...@@ -896,11 +896,20 @@
<button <button
class=" text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-850 transition rounded-full p-2 self-center" class=" text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-850 transition rounded-full p-2 self-center"
type="button" type="button"
on:click={() => { on:click={async () => {
if (selectedModels.length > 1) { if (selectedModels.length > 1) {
toast.error($i18n.t('Select only one model to call')); toast.error($i18n.t('Select only one model to call'));
} else {
return;
}
// check if user has access to getUserMedia
try {
await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
// If the user grants the permission, proceed to show the call overlay
showCallOverlay.set(true); showCallOverlay.set(true);
} 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'));
} }
}} }}
> >
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment