Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-12335

captureVideo() crashes the app when running to an android 6.0 or 7.0 emulator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • None

    Description

      cordova 6.4
      cordova android platform 6.0
      cordova-media-capture plugin 1.4.1

      built : android sdk version 24

      When using Android 6.0 emulator :

      target Android 6.0 - API Level 23
      cpu Intel Atom (x86_64)
      front and back camera emulated
      memory RAM 1024
      VM heap 64
      internal storage 16 GiB
      SD card 4 GiB

      The emulated camera starts recording a video, stops correctly, but crashes the app when validate the captured video.

      adb logcat trace
      01-09 11:04:55.485  1913  2552 E DatabaseUtils: Writing exception to parcel
      01-09 11:04:55.485  1913  2552 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/video/media/40 from pid=3130, uid=10056 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
      01-09 11:04:55.485  1913  2552 E DatabaseUtils:         at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:605)
      01-09 11:04:55.485  1913  2552 E DatabaseUtils:         at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:480)
      01-09 11:04:55.485  1913  2552 E DatabaseUtils:         at android.content.ContentProvider$Transport.query(ContentProvider.java:211)
      01-09 11:04:55.485  1913  2552 E DatabaseUtils:         at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
      01-09 11:04:55.485  1913  2552 E DatabaseUtils:         at android.os.Binder.execTransact(Binder.java:453)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
      01-09 11:04:55.487  3130  3189 E AndroidRuntime: Process: com.saipm.dh, PID: 3130
      01-09 11:04:55.487  3130  3189 E AndroidRuntime: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/video/media/40 from pid=3130, uid=10056 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:1599)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at android.content.ContentResolver.query(ContentResolver.java:491)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at android.content.ContentResolver.query(ContentResolver.java:434)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at org.apache.cordova.CordovaResourceApi.mapUriToFile(CordovaResourceApi.java:154)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at org.apache.cordova.mediacapture.Capture.createMediaFile(Capture.java:433)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at org.apache.cordova.mediacapture.Capture.onVideoActivityResult(Capture.java:413)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at org.apache.cordova.mediacapture.Capture$1.run(Capture.java:332)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      01-09 11:04:55.487  3130  3189 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:818)
      01-09 11:04:55.488  1630  2026 W ActivityManager:   Force finishing activity com.saipm.dh/.MainActivity
      

      When using Android 7.0 emulator :

      target Android 7.0 - API Level 24
      cpu Intel Atom (x86_64)
      front and back camera emulated
      memory RAM 1024
      VM heap 64
      internal storage 16 GiB
      SD card 8 GiB

      When captureVideo() is invoked, the emulated camera does not start and the app crashes immediately.

      adb logcat trace
      01-09 10:40:23.266  1252  1252 V EmulatedCamera_Camera: getCameraInfo
      01-09 10:40:23.266  1252  1252 V EmulatedCamera_BaseCamera: getCameraInfo
      01-09 10:40:23.291 28517 28534 E AndroidRuntime: FATAL EXCEPTION: Thread-2
      01-09 10:40:23.291 28517 28534 E AndroidRuntime: Process: com.android.camera, PID: 28517
      01-09 10:40:23.291 28517 28534 E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'int android.hardware.Camera$Size.width' on a null object reference
      01-09 10:40:23.291 28517 28534 E AndroidRuntime:        at com.android.camera.VideoCamera.getDesiredPreviewSize(VideoCamera.java:799)
      01-09 10:40:23.291 28517 28534 E AndroidRuntime:        at com.android.camera.VideoCamera.readVideoPreferences(VideoCamera.java:781)
      01-09 10:40:23.291 28517 28534 E AndroidRuntime:        at com.android.camera.VideoCamera.-wrap3(VideoCamera.java)
      01-09 10:40:23.291 28517 28534 E AndroidRuntime:        at com.android.camera.VideoCamera$1.run(VideoCamera.java:389)
      01-09 10:40:23.291 28517 28534 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:761)
      01-09 10:40:23.293  1503  1514 W ActivityManager:   Force finishing activity com.android.camera/.VideoCamera
      01-09 10:40:23.295  1503  1514 W ActivityManager:   Force finishing activity com.saipm.dh/.MainActivity
      01-09 10:40:23.322 28517 28528 I art     : Background sticky concurrent mark sweep GC freed 8683(640KB) AllocSpace objects, 4(80KB) LOS objects, 0% free
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            portos Zia Sergio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: