Skip to content

Commit

Permalink
fixed auto mic permission popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiral-Memory committed Mar 28, 2024
1 parent ba3faf0 commit 8ca4248
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Components/Patient/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,14 @@ export const FileUpload = (props: FileUploadProps) => {
useEffect(() => {
const checkMicPermission = async () => {
try {
await navigator.mediaDevices.getUserMedia({ audio: true });
setIsMicPermission(true);
const permissions = await navigator.permissions.query({
name: "microphone" as PermissionName,
});
if (permissions.state === "granted") {
setIsMicPermission(true);
} else {
setIsMicPermission(false);
}
} catch (error) {
setIsMicPermission(false);
}
Expand Down

0 comments on commit 8ca4248

Please sign in to comment.