apache / cordova-plugin-media-capture

Apache Cordova Media Capture Plugin
https://cordova.apache.org/
Apache License 2.0
307 stars 497 forks source link

App crash on `captureVideo()` on android 14. #300

Open Saqib92 opened 2 months ago

Saqib92 commented 2 months ago

Bug Report

Problem

captureVideo() crash app on android 14.

What is expected to happen?

it should record video.

What does actually happen?

App Crash

Information

Command or Code

recordVid(limit: number = 1): Promise<any> {
    let options: CaptureVideoOptions = { limit: limit, quality: 80 };
    return new Promise(resolve => {
      this.mediaCapture.captureVideo(options).then((data: any) => {
        resolve(data);
      },
        (err: CaptureError) => {
          console.error(err)
        })
    }); //promise
  }

Environment, Platform, Device

Ionic + Capacitor 6 Android 14

Version information

Plugins info:

"cordova-plugin-file": "^8.1.0",
"cordova-plugin-file-transfer": "^2.0.0",
"cordova-plugin-media-capture": "^5.0.0",

"@awesome-cordova-plugins/file": "^6.8.0",
"@awesome-cordova-plugins/file-transfer": "^6.8.0",
"@awesome-cordova-plugins/media-capture": "^6.8.0",

Capacitor: "@capacitor/core": "^6.0.0" Ionic: "@ionic/angular": "^7.5.0" Angular: "@angular/core": "^18.2.0",

AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<!-- Geolocation API -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>

Checklist

mirko77 commented 4 weeks ago

What is the output of logcat?

You probably need to ask permissions, for example using cordova-diagnostic-plugin


 cordova.plugins.diagnostic.requestRuntimePermission(
                function (status) {
                    if (status === cordova.plugins.diagnostic.permissionStatus.GRANTED) {
                        window.navigator.device.capture.captureVideo(
                            _onCaptureVideoSuccess,
                            _onCaptureVideoError,
                            options
                        );
                    } else {
                        //warn user camera permission is compulsory
                       //...

                    }
                },
                function (error) {
               //error code
              //...

                },
                cordova.plugins.diagnostic.permission.CAMERA
            );
Saqib92 commented 4 weeks ago

I already have Camera and Microphone permission granted. and plugin is working for android 13 only crashing on android 14.

mirko77 commented 4 weeks ago

@Saqib92 the logcat output might be helpful.

Saqib92 commented 1 week ago

the logs:

2024-11-14 13:16:48.191  6437-6437  Capacitor/Plugin        com.wizdiary.app                     V  To native (Cordova plugin): callbackId: Capture333875194, service: Capture, action: captureVideo, actionArgs: [{"limit":1,"quality":80}]
2024-11-14 13:16:48.210  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.214  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.242  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.245  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.245  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.250  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.254  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.267  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.267  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.268  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.271  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.277  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.277  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.278  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.287  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.289  6437-6437  Capacitor/AppPlugin     com.wizdiary.app                     V  Notifying listeners for event pause
2024-11-14 13:16:48.289  6437-6437  Capacitor/AppPlugin     com.wizdiary.app                     D  No listeners found for event pause
2024-11-14 13:16:48.289  6437-6437  Capacitor               com.wizdiary.app                     D  App paused
2024-11-14 13:16:48.298  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.301  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.329  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.336  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.347  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.350  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.364  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.368  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.378  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.389  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.391  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.394  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.395  6437-6557  om.wizdiary.app         com.wizdiary.app                     E  == MALI DEBUG ===BAD ALLOC from gles_texture_egl_image_get_2d_template err is 0
2024-11-14 13:16:48.403  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.407  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.412  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.415  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.432  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.435  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.463  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.466  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.497  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.501  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.527  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.552  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.556  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.562  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.565  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.578  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.598  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.603  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.617  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.621  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.630  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.634  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.651  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.671  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.685  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.709  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.733  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.740  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
2024-11-14 13:16:48.757  6437-6495  GPUAUX                  com.wizdiary.app                     E  [AUX]GuiExtAuxCheckAuxPath:670: Null anb
2024-11-14 13:16:48.760  6437-6495  gralloc4                com.wizdiary.app                     I  @set_metadata: update dataspace from GM (0x00000000 -> 0x08010000)
--------- beginning of crash
2024-11-14 13:16:49.798  6437-6495  GED                     com.wizdiary.app                     I  ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
2024-11-14 13:16:49.818  6437-6437  BLASTBufferQueue        com.wizdiary.app                     D  [VRI[MainActivity]#0](f:0,a:2) destructor()
2024-11-14 13:16:49.819  6437-6437  BufferQueueConsumer     com.wizdiary.app                     D  [VRI[MainActivity]#0(BLAST Consumer)0](id:192500000000,api:0,p:-1,c:6437) disconnect
2024-11-14 13:16:49.826  6437-6495  GED                     com.wizdiary.app                     I  ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
2024-11-14 13:16:49.830  6437-6437  Capacitor/AppPlugin     com.wizdiary.app                     D  Firing change: false
2024-11-14 13:16:49.830  6437-6437  Capacitor/AppPlugin     com.wizdiary.app                     V  Notifying listeners for event appStateChange
2024-11-14 13:16:49.830  6437-6437  Capacitor/AppPlugin     com.wizdiary.app                     D  No listeners found for event appStateChange
2024-11-14 13:16:49.832  6437-6437  Capacitor               com.wizdiary.app                     D  App stopped
2024-11-14 13:16:49.837  6437-6437  Capacitor               com.wizdiary.app                     D  Saving instance state!
2024-11-14 13:16:49.853  6437-6437  Capacitor               com.wizdiary.app                     D  App destroyed
2024-11-14 13:16:49.854  6437-6437  WindowOnBackDispatcher  com.wizdiary.app                     W  sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda23@2715537
2024-11-14 13:16:49.863  6437-6495  GED                     com.wizdiary.app                     I  ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
2024-11-14 13:16:49.865  6437-6495  GED                     com.wizdiary.app                     I  ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
2024-11-14 13:16:49.870  6437-6495  GED                     com.wizdiary.app                     I  ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
2024-11-14 13:16:49.871  6437-6437  View                    com.wizdiary.app                     D  [Warning] assignParent to null: this = DecorView@fe2796a[MainActivity]
2024-11-14 13:16:49.937  6437-6437  chromium                com.wizdiary.app                     E  [ERROR:aw_browser_terminator.cc(165)] Renderer process (6507) crash detected (code -1).