Skip to content

Commit

Permalink
added error message for accessing mic unsecurely
Browse files Browse the repository at this point in the history
  • Loading branch information
NivEz committed Aug 20, 2023
1 parent 593c789 commit a863973
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/hooks/useAudioAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export const useAudioAnalyzer = ({isActive, handleBrightness}) => {
alert("Please allow microphone");
}

navigator.getUserMedia({audio: true}, soundAllowed, soundNotAllowed);
try {
navigator.getUserMedia({audio: true}, soundAllowed, soundNotAllowed);
} catch (err) {
alert("You can use your microphone only from localhost or with secure connection (https)");
}

return () => clearInterval(audioInterval);
}, [isActive])
Expand Down

0 comments on commit a863973

Please sign in to comment.