XavierMallat opened a new pull request, #302:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/302

   <!--
   Please make sure the checklist boxes are all checked before submitting the 
PR. The checklist is intended as a quick reference, for complete details please 
see our Contributor Guidelines:
   
   http://cordova.apache.org/contribute/contribute_guidelines.html
   
   Thanks!
   -->
   
   ### Platforms affected
   
   Android
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   In an app that I develop, the captured file needs to be moved to a specific 
app directory. In current plugin version, it works for most Android overlays 
versions, but for some, it does not (#289, #286, #233, #277, #221, #196 and 
#210) due to Android's limitation to use external files.
   The PR [!215 
](https://github.com/apache/cordova-plugin-media-capture/pull/215) did exactly 
the job I needed, so I just retrieved @chriskhongqarma's changes and applied 
them to current master branch with suggestions.
   
   
   ### Description
   <!-- Describe your changes in detail -->
   The idea is to use a ContentProvider (a 
[FileProvider](https://developer.android.com/reference/androidx/core/content/FileProvider),
 in this case) as a common database to store files, so that both our app and 
other apps can get access to.
   An empty file (audio, image, video) with unique file name (which is 
generated using current timestamp) and corresponding file format will be 
created before capturing. Unique file name prevents the file from being 
duplicated. We use FileProvider to create a Uri for the file, and send it 
through capturing intents as 
[EXTRA_OUTPUT](https://developer.android.com/reference/android/provider/MediaStore#EXTRA_OUTPUT),
 so that the created file will be saved with the above Uri. Meanwhile, we store 
the file absolute path as a global variable, so that it can be used when the 
intent returns results.
   As the file is saved into FileProvider, the app will get access and have 
control over the created file.
   
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   captureAudio, captureImage, captureVideo features are tested over various 
Android devices (from Android 10 to Android 14 are covered) using 
[browserstack](https://www.browserstack.com/) app live. The app then has full 
access over the generated media file (move, delete, transcode, etc).
   
   
   ### Checklist
   
   - [X] I've run the tests to see all new and existing tests pass
   - [X] I added automated test coverage as appropriate for this change
   - [X] Commit is prefixed with `(platform)` if this change only applies to 
one platform (e.g. `(android)`)
   - [X] If this Pull Request resolves an issue, I linked to the issue in the 
text above (and used the correct [keyword to close issues using 
keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [X] I've updated the documentation if necessary
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to