apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
960 stars 1.52k forks source link

Need a method stop() to close the Camera or PhotoLibrary from code. #874

Open NityaSantosh26 opened 5 months ago

NityaSantosh26 commented 5 months ago

Feature Request

Motivation Behind Feature

It's really helpful to have a control to close the resources like CAMERA or PHOTOLIBRARY. UseCases:

Feature Description

It's just a new method which is supposed to close the CAMERA or PHOTOLIBRARY from code. By calling this method, it closes the resources and resumes the app to it's initial state.

Alternatives or Workarounds

For me, It's a blocking issue as it's supposed to close the CAMERA automatically but that's not the behavior with the plugin as there's no method available to close it. So the implemenation of the stop() for both Android and iOS is needed.

I can contribute by implementing the stop() which closes the resources from javascript. By calling navigator.camera.stop() which works for both android and iOS.

Here's a PR that I have created. Please go through the implementation. https://github.com/apache/cordova-plugin-camera/pull/873