cordova-plugin-media-capture
cordova-plugin-media-capture copied to clipboard
iOS 13 can't access recorded video using cordova-plugin-file
Bug Report
Problem
I can't use cordova-plugin-file
to access a recorded video on iOS.
What is expected to happen?
I should be able to use the following code to access the recorded video file:
window.resolveLocalFileSystemURL(path, entry => {
// I should be able to do something with the value in `entry`
}, err => {
// But I get an error with the status code of 5
});
What does actually happen?
When trying to use the above code, the error callback is called with err
containing { code: 5 }
.
Information
The above code works in Android, it's only iOS that I'm having an issue.
The fullPath
value provided after successfully calling navigator.device.capture.captureVideo()
is something like the following: /private/var/mobile/Containers/Data/Application/7EF20D5A-03FE-4EA1-877A-8260CBCCE049/tmp/61945023201__49A539F3-B9CF-4E9B-B8B9-E497668AD4E7.MOV
.
There is an open issue for cordova-plugin-camera
that might be similar: https://github.com/apache/cordova-plugin-file/issues/346
I tried implementing the fix mentioned in the above issue, but even after copying the file to another location and renaming it I still get the same problem.
I've also tried adding File://
to the start of fullPath
, but it resulted in the same issue.
It's worth mentioning that I've added the follow permissions to my config.xml
.
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>We need camera access to take photos and record videos for theholla.co</string>
</edit-config>
<edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
<string>We need microphone access to record audio while you're making videos for theholla.co</string>
</edit-config>
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>We need access to your gallery so you can access photos / videos to upload to theholla.co</string>
</edit-config>
The following SOF (relates to React Native, but should still be appropriate) comment advises that I don't need any additional permissions to read / write to an iOS device. So I'm working on the assumption that the above is all that's needed to read / write to the device.
https://stackoverflow.com/questions/53082568/how-can-i-request-ios-storage-permission-in-react-native
Environment, Platform, Device
Development Environment: OSX 10.15.1 / Xcode 11.5 Device: iPhone 6S+ (iOS 13.5.1)
Version information
cordova: 10.0 cordova-ios: 6.1.0 cordova-android: 8.1.0 cordova-browser: 6.0.0 cordova-plugin-android-permissions: 1.0.2 cordova-plugin-file: 6.0.2 cordova-plugin-media-capture: 3.0.3
Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
@scattered same issue here
@scattered Same issue for me
Facing Same issue
Facing Same issue
in IOS this is what fixed the issue for me : remove the '/private' and add file://
fixIosFilePath(path: string) {
if (path.indexOf('/private/') === 0) {
path = 'file://' + path.substr(8);
}
return path;
}
same issue , l have : Failed to load resource: the server responded with a status of 404 () ionic://localhost/var/mobile/Containers/Data/Application/7303203F-585A-43EE-8C5D-6590E6FC27C5/Library/NoCloud/63431338914__90444BBF-32B2-4FBF-B26F-7387CCD5E07E.MOV