Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

PR to resolve issue #259, camera request on firefox #288

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ export class BarcodeScannerWeb extends WebPlugin implements BarcodeScannerPlugin
unknown: true,
};
} catch {
throw this.unavailable('Camera permissions are not available in this browser');
try {
await navigator.mediaDevices.getUserMedia({video: true});
return { granted: true };
} catch (err) {
if ( (err as DOMException).name === 'NotAllowedError') {
return { denied: true };
} else {
throw this.unavailable('Camera permissions are not available in this browser');
}
}
}
}

Expand Down