I'm working on a hybrid project that uses cordova for building both iOS and Android.
My problem is with iOS uploads. There's an option for "uploading" photo, where the users can also "Take photo". For this, I'm usign cordova-plugin-ios-camera-permissions.
At my config.xml, I've added the following permissions:
<platform name="ios">
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>need camera access to take pictures</string>
</edit-config>
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>need photo library access to upload images</string>
</edit-config>
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>need location access to find things nearby</string>
</edit-config>
<edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
<string>need photo library access to save pictures there</string>
</edit-config>
</platform>
But when user taps on "Take video", the app crashes, because there's no permission to use the microphone (NSMicrophoneUsageDescription).
I think the problem can be solved by adding this permission to PList.info (via config.xml), but ... there's no "upload video" feature in my app...
My question is: is it possible to block the 'Take video' or should I simply add the microphone permission?
CodePudding user response:
I've solved it by blocking video types using input "accept" property:
<input type="file" accept="image/*" id="my_file" />
In result, iOS didn't showed the "take video" option.
Complete reference can be found at: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept