diff --git a/src/web.ts b/src/web.ts index 5c7e91b..f39354e 100644 --- a/src/web.ts +++ b/src/web.ts @@ -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'); + } + } } }