如何解决CAMERA_UNAVAILABLE问题

问题描述

当我尝试为我的qrcode插件打开相机时出现此错误

enter image description here

我的代码

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');

}

我到处搜索,没有找到答案

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)