Skip to content

Commit

Permalink
mic warning to render when mic permission is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiral-Memory committed Mar 28, 2024
1 parent c850fce commit ba3faf0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Components/Patient/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,23 @@ export const FileUpload = (props: FileUploadProps) => {
]);
const [isMicPermission, setIsMicPermission] = useState(true);

useEffect(() => {
const checkMicPermission = async () => {
try {
await navigator.mediaDevices.getUserMedia({ audio: true });
setIsMicPermission(true);
} catch (error) {
setIsMicPermission(false);
}
};

checkMicPermission();

return () => {
setIsMicPermission(true);
};
}, []);

const { data: patient } = useQuery(routes.getPatient, {
pathParams: { id: patientId },
prefetch: !!patientId,
Expand Down

0 comments on commit ba3faf0

Please sign in to comment.