Ionic framework 如何解决摄像头不可用的问题
我在尝试打开qrcode插件的摄像头时出现此错误 我的代码:Ionic framework 如何解决摄像头不可用的问题,ionic-framework,ionic4,ionic-native,Ionic Framework,Ionic4,Ionic Native,我在尝试打开qrcode插件的摄像头时出现此错误 我的代码: scancode() { this.qrScanner.prepare() .then((status: QRScannerStatus) => { if (status.authorized) { // camera permission was granted // start scanning let scanSub = this.qrScanner.
scancode() {
this.qrScanner.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
// camera permission was granted
// start scanning
let scanSub = this.qrScanner.scan().subscribe((text: string) => {
console.log('Scanned something', text);
this.qrScanner.hide(); // hide camera preview
scanSub.unsubscribe(); // stop scanning
});
} else if (status.denied) {
// camera permission was permanently denied
// you must use QRScanner.openSettings() method to guide the user to the settings page
// then they can grant the permission from there
this.qrScanner.openSettings();
window.document.querySelector('ion-app').classList.add('transparent-body');
} else {
// permission was denied, but not permanently. You can ask for permission again at a later time.
this.qrScanner.openSettings();
window.document.querySelector('ion-app').classList.add('transparent-body');
}
})
.catch((e: any) => console.log('Error is', e));
window.document.querySelector('ion-app').classList.add('transparent-body');
}
我到处找,没有找到答案