Application restart on video capture callback with cordova-plugin-media-capture

Viewed 365

I have been using the cordova-plugin-media-capture plugin for some time now without any problems on Android and iOS.

Except under Android 9 or after closing the camera (with or without video to return) the webview restarts.

I searched everywhere in the github issues of the plugin and on this forum but without success...

I also have trouble understanding what's happening with the logs because as soon as the application restarts I have the process that switch to "DEAD" status and so I no longer have the logs in Android Studio.

I may have help with

https://developer.android.com/about/versions/oreo/android-8.0-changes#back-all

or https://developer.android.com/about/versions/pie/android-9.0-changes-28

I would like to point out that this does not work even if I disable battery optimization from the parameters.

Here was the code I use :

var captureSuccess = function(mediaFiles) {
    // didn't reach this code
}.bind(this);

var captureError = function(error) { };

navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1, duration:60});

Did you have any ideas?

EDIT 1 :

At the end of the README of cordova-plugin-media-capture we can read this :

When capturing audio, video, or images on the Android platform, there is a chance that the application will get destroyed after the Cordova Webview is pushed to the background by the native capture application.

I'm affraid about it cause i use ExtJS framework which are unable (or i don't know how) to save and restore state at the resume event... Do you know how to avoid the apps to be destroyed ?

1 Answers

Sir, same problem with me tried everything other than searching in forums :)

but i think it is a issue with cordova only, tried this

navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1, duration:60});

but there is now acceptance (right tick/ accept this) to invoke call the onSuccess function from the UI after capture options work perfectly

Successfully worked on Android 6,7,8 on emulator but getting error on android 9 on personal mobile device (nokia 6.1) Hoping you have this issue if possible....

getting this error after catching error on console after pressing back after recording video

{code: 3, message: "Canceled."}

code: 3 message: "Canceled." proto: Object

hope somethings gets resolved...

Related