mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Merge pull request #253 from Monadical-SAS/fix-firefox-permissions
Fix permission detection system on firefox
This commit is contained in:
@@ -44,6 +44,7 @@ const TranscriptCreate = () => {
|
|||||||
requestPermission,
|
requestPermission,
|
||||||
getAudioStream,
|
getAudioStream,
|
||||||
} = useAudioDevice();
|
} = useAudioDevice();
|
||||||
|
|
||||||
const [hasRecorded, setHasRecorded] = useState(false);
|
const [hasRecorded, setHasRecorded] = useState(false);
|
||||||
const [transcriptStarted, setTranscriptStarted] = useState(false);
|
const [transcriptStarted, setTranscriptStarted] = useState(false);
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default function Recorder(props: RecorderProps) {
|
|||||||
const handleKeyPress = (event: KeyboardEvent) => {
|
const handleKeyPress = (event: KeyboardEvent) => {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "~":
|
case "~":
|
||||||
location.href = ""
|
location.href = "";
|
||||||
break;
|
break;
|
||||||
case ",":
|
case ",":
|
||||||
location.href = "/transcripts/new";
|
location.href = "/transcripts/new";
|
||||||
|
|||||||
@@ -21,6 +21,21 @@ const useAudioDevice = () => {
|
|||||||
}, [permissionOk]);
|
}, [permissionOk]);
|
||||||
|
|
||||||
const checkPermission = (): void => {
|
const checkPermission = (): void => {
|
||||||
|
if (navigator.userAgent.includes("Firefox")) {
|
||||||
|
navigator.mediaDevices
|
||||||
|
.getUserMedia({ audio: true, video: false })
|
||||||
|
.then((stream) => {
|
||||||
|
setPermissionOk(true);
|
||||||
|
setPermissionDenied(false);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
setPermissionOk(false);
|
||||||
|
setPermissionDenied(false);
|
||||||
|
})
|
||||||
|
.finally(() => setLoading(false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
navigator.permissions
|
navigator.permissions
|
||||||
.query(MIC_QUERY)
|
.query(MIC_QUERY)
|
||||||
.then((permissionStatus) => {
|
.then((permissionStatus) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user