Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error! getUserMedia error: NotReadableError in android device #1

Open
ravipandit14 opened this issue Jul 11, 2020 · 3 comments
Open

Comments

@ravipandit14
Copy link

Issue: getUserMedia error: NotReadableError in android device
Description: I have created .apk file from this example by ionic cordova build android command
and when I am trying to login with name r1 it's return error.

Screenshot:
WhatsApp Image 2020-07-11 at 2 15 15 AM

package.json

"@ionic/angular": "^5.0.0",
"cordova-android": "^8.1.0",
"core-js": "^2.5.4",
"peerjs": "^1.2.0",
"rxjs": "~6.5.1",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"

@timsar2
Copy link
Owner

timsar2 commented Jul 11, 2020

Make sure you have permission to access camera and microphone.
Check your config.Xml.
or maybe camera is using by another app.
usually this error happening when camera is using by another app like you are using webcam in chrome and want to open webcam in firefox too in the same time.

@ravipandit14
Copy link
Author

@timsar2 I have write a code for AndroidPermission But after allow permission and trying to login in device It returns same issue.

WhatsApp Image 2020-07-12 at 7 44 05 PM

Code in app.components.ts

 initializeApp() {
    this.platform.ready().then(() => {
      this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
        result => console.log('Has permission?',result.hasPermission),
        err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
      );
      
      this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
  }

@timsar2
Copy link
Owner

timsar2 commented Jul 13, 2020

@timsar2 I have write a code for AndroidPermission But after allow permission and trying to login in device It returns same issue.

Code in app.components.ts

 initializeApp() {
    this.platform.ready().then(() => {
      this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
        result => console.log('Has permission?',result.hasPermission),
        err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
      );
      
      this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
  }

What about record?
Add request permission and uses-feature to config.xml too.

<platform name="android">
        <config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http:https://schemas.android.com/apk/res/android">                        
            <uses-permission android:name="android.permission.CAMERA" />
            <uses-permission android:name="android.permission.RECORD_AUDIO" />
            <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <uses-feature android:name="android.hardware.camera" android:required="true" />
            <uses-feature android:name="android.hardware.microphone" android:required="true" />
        </config-file>
...
</platform>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants