jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 39 forks source link

Android: Permission Error - MIME type video/mp4 cannot be inserted into content #129

Closed brooklax closed 3 years ago

brooklax commented 3 years ago

Describe the bug When creating a new NS app using ns create and adding the mediafilepicker library to capture video the below error is produced when the mediafilepicker is invoked:

JS: Permission Error! Error: java.lang.IllegalArgumentException: MIME type video/mp4 cannot be inserted into content://media/external/images/media; expected MIME type under image/*

I have tried to build the demo from the nativescript-mediafilepicker repo as is and experience the same result.

To Reproduce Steps to reproduce the behavior: The build is being tested on a OnePlus 7 running Android 10. You can clone this repo and then run ns run android and tap the button to invoke the mediafilepicker.

NativeScript Info(please run tns info): ✔ Getting NativeScript components versions information... ⚠ Update available for component nativescript. Your current version is 7.0.8 and the latest available version is 7.0.11. ✔ Component @nativescript/core has 7.0.13 version and is up to date. ✖ Component @nativescript/ios is not installed. ✔ Component @nativescript/android has 7.0.1 version and is up to date.

Sample Code(please provide minimum code to reproduce problem): https://github.com/gideon-io/test-videorecord-ts

Additional context I have tried to add this to my AndroidManifest to see if it makes a difference however a different error is thrown when the app tries to build.

Execution failed for task ':app:processDebugResources'.
Android resource linking failed
/Users/godz/projects/temp/nativescript-mediafilepicker/demo/platforms/android/app/src/main/AndroidManifest.xml:17:2-39:16: AAPT: error: attribute android:requestLegacyExternalStorage not found.

Unable to apply changes on device: c1fa43c4. Error is: Command ./gradlew failed with exit code 1.
jerbob92 commented 3 years ago

requestLegacyExternalStorage is only available if you target Android 10 (API level 29) or higher.

I just released version 4.0.2, can you check if that works?

brooklax commented 3 years ago

4.0.2 seems to be working as expected. Thank you for your assistance and I appreciate the clarification on the requestLegacyExternalStorage permission. Cheers @jerbob92