-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS13 file_uri error picking video from gallery #506
Comments
*** ADITIONAL INFO: I've found in Stack Overflow this information about this problem (to help you to solve it) The problem was the image picker delegate passed the file's url to another class that then handled copying the file. This has worked fine for several years in our application but with iOS 13, once the image picker delegate goes away, the url immediately becomes invalid. |
Hi again! in CDVCamera.m change THIS:
to THIS:
|
@litiobat This is the case now for iOS 13. We've just upgraded our testing devices to iOS 13, and we found that we aren't able to select video files from the gallery camera roll. Your fix should be merged with the master branch. Any clues? Many thanks |
Attention! If your app has video upload feature, then this issue will be one of the most important issues you will face when your app users start upgrading their iOS devices to v13. I believe that not all cordova developers have upgraded their testing devices yet, thats why this thread is not getting so much attention. Thanks for @litiobat and for his efforts in helping the community solving this issue. Please read his description and the comment he added then after. I have an app in production, which has video upload feature. I forked the master plugin and applied @litiobat's fix, for any of you guys interested in solving this issue, you can use this fork below:
I have to add that this didn't solely fix the issue for me, because the returned path is not prefixed with the file:// protocol, so please keep in mind that in the success callback check for the file protocol and fix that accordingly, as follows:
I believe applying this fix in the master plugin is better and safer for all, however some developers can't wait for the next release. Wish the best for all. |
Sounds like there are already some potential solutions here. We'd welcome any PRs. Cordova is a small team of volunteers. |
Hi, same problem on IOS 13. |
Just wanted to add my 2 cents. I have seen this problem too, when I upgraded to IOS 13. I am using Xam.Plugin.Media to access movie files and in my code I was using System.IO.File.Move and that is where the exception occurs. In looking at my internal debug and crash log I saw that the exception is on System.IO.FileSystem.DeleteFile, which is accurate since a move will delete the source file. I used System.IO.File.Copy and there was no issue. The only problem may be, what happens to all the files in the private directory? Do they get deleted when the app closes? Not really sure. But, the bottom line is that you can access movies from the Photos using the picker. |
Hi joaolnpr,
I am able to grab a camera video and using the share mechanism, get it into my app. I don’t use the url directly, I immediately copy it local storage and use that item to access the video.
I use System.IO.File.Copy(src, dest) - src is the url from the actual camera video and dest is my local storage. This is under IOS 13. Maybe this will help.
Best Regards,
rdcs
From: joaolnpr <[email protected]>
Reply-To: apache/cordova-plugin-camera <[email protected]>
Date: Monday, October 14, 2019 at 4:10 AM
To: apache/cordova-plugin-camera <[email protected]>
Cc: Daly Robert <[email protected]>, Comment <[email protected]>
Subject: Re: [apache/cordova-plugin-camera] iOS13 file_uri error picking video from gallery (#506)
Hello guys,
We are facing the same issue, any solution?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
The directory for videos simply changed. I parse the file uri response to add in file:/// if missing and to remove Videos Broken: Photos work: Even if i switch to DATA_URL it still returns the path above on videos |
After forking with @markerio 's suggestion, I found that my FILE_URI was still not being accepted. This time I was getting error code 5 - Encoding Err. :( Now the URL is: This is what ended up working: |
cleanup for bugfix apache/cordova-plugin-file#346 apache#506 (comment)
@litiobat Hi is this work for ios lower version like 12 or else? |
@litiobat fix worked for me on selection of the video from library, however the issue remains when recording a video and then returning the path for viewing. Weirdly I also have a broken Android app. See the URL differences between Android and iOS in the images below: Has anyone else had a broken android version? |
You sir are a true intellectual! Thank you, very cool. |
I can confirm that this fix worked for us for iOS 13.2.2. |
This works for me. iOS 13.1.3 |
So I am having a "Upload Video from gallery" feature on my app. When I run it on iOS emulator, it works as expected. That is, I am able to choose a video file from the gallery, and then upload it. Here is my code - My options are - public options = { My getVideo function -
My code goes into - error resolving file - with error code - 1 I have tried the changes mentioned above by @markerio - changed my camera.h and camera.m files Am I doing something wrong? |
Hi, can someone please give a sample code for video upload which is working? I have exactly same problem as @neerajsaxena0711 and @litiobat's solution and @markerio's fork did not work for me too. Same with @tmk1991's comment. |
@saurabhDuzumaki @neerajsaxena0711 Please find below the simplest implementation of picking a video from the camera roll in iOS13. Tested in all v13 releases including the latest v13.2.3. First, please follow @litiobat fix and change CDVCamera.m file as suggested. I forked the master plugin and applied @litiobat's fix, here is the link for any of you guys interested in this fork:
Then, setup the plugin to retrieve a video from the device's gallery. The picker should be triggered as follows:
The success callback should be as follows:
Please reply back if you find this helpful. Hope this helps. |
@markerio 's solution works. If you want to use the Promise you could do as follows:
|
Yes, I can confirm that @markerio 's solution is working on iOS 13.1.2. Tested on real device. Thanks a ton! Was scratching my head over this since a long time. "cdvfile://localhost/temporary/trim.8AEDB9C9-6E4C-4F65-8029-D453842E91F6.MOV" "file:///Users/Neeraj-saxena/Library/Developer/CoreSimulator/Devices/9D5725F4-968E-4669-8EAF-CCC0971BE8AF/data/Containers/Data/Application/6A311514-1F0D-416B-8895-84F1EBE0F58C/tmp/trim.0032325E-5FD8-4B5B-9937-A478BD958F8C.MOV" My video tag is - <video autoplay controls #myvideo> |
Can anyone tell me how do I play the "chosen" video from the gallery? The URL that I get doesn't seem to work when embedded with the video tag. I have tried a lot of solutions like converting the URL to localURL, nativeURL, etc. But couldn't get the path right. Happening both on Android and iOS. My File entry object is -
|
@Taylorsuk did you get it sorted on Android? |
@tryhardest Afraid not. I elected to use standard HTML inputs in a round about way and took the opportunity to remove another Cordova plugin from my app. |
@Taylorsuk What issue are you facing on android? |
Can anyone tell me how do I play the "chosen" video from the gallery? The URL that I get doesn't seem to work when embedded with the video tag. I have tried a lot of solutions like converting the URL to localURL, nativeURL, etc. But couldn't get the path right. Happening both on Android and iOS. My File entry object is - {"name":"20191107_170431.mp4", |
@neerajsaxena0711 I summarised all the issues in this here #506 (comment) |
Tks @markerio, it worked for me. |
IOS: The same issue, when I want to copy file with File plugin or upload it to firebase storage I have an error, FIle not found. Received file path is: 'file:///private/var/mobile/Containers/Data/PluginKitPlugin/89C88915-49F8-4B74-83D0-011C8B617DD9/tmp/trim.654E18A8-8AE3-4D51-96BD-3FB1D990E77C.MOV'. |
Thank GOD i found this!!!! Thank you so much @neerajsaxena0711 |
Does this mean that #533 is not necessary anymore? 🤔 |
Didn't see that issue mentioned was from UnityNativeGallery 😰 |
THIS IS THE ONE THAT WORKED FOR ME! I hope this is incorporated in the official plugin soon. |
Are there plans to incorporate this change? While it works on a developer's environment, CI/CD processes build apps by way if install pods will revert manual changes to the non-working contained in the plugin's package. |
Hi all, Just used the 5.0.1 version in my app, and this version has solved this problem for us. |
this works for me. Thanks |
Hello everyone I tried the same method, I am still getting nil from
Can anyone please help, I have all these three permissions related to camera in my info.plist
Is there any other key which I need to add to the plist file ? |
I have solved this issue just by removing and adding camera plugin in my application, You should try this too. The changes in Cordova-camera plugin which solves the issue are as following: |
Hi All,
|
Bug Report
Problem
In iOS 13, picking video from Roll returns a bad FILE_URI no proprietary (only affected picking video, no photo)
What is expected to happen?
Return a valid proprietary FILE_URI url to work with it (for upload to server, for example)
like: file:///var/mobile/Containers/Data/Application/98D7C3AE-A24F-46CE-A3B4-CF03B26355BE/tmp/video.mp4
What does actually happen?
Returns a invalid non proprietary FILE_URI with no access to work with, like:
file:///private/var/mobile/Containers/Data/PluginKitPlugin/43792FA5-A8F8-4ECA-8CCE-0C5877088858/tmp/trim.7F9B8FC4-3307-4452-9F96-46A5D9A9DDD5.MOV
Information
Using any iOS device, like iPhone upgraded to iOS 13, try to pick a video (no photo) and then load the FILE_URI returned by plugin. If you'll try to use this FILE_URI to any action, like upload the file to server for example, the log in xcode says "Error opening file. Error Domain=NSCocoaErrorDomain Code=257. You are not allowed to read this file."
** Note: This function works correctly before upgrade to iOS13. I've tried it to many iOS devices with the same result.
Command or Code
var options = {
destinationType: 1,
sourceType : 0,
mediaType: 1
};
navigator.camera.getPicture(correcto, fail, options);
Environment, Platform, Device
MacOS Mojave, using Xcode 11 and iPhone Xs upgraded to iOS 13
Version information
Cordova 9, Camera Plugin upgraded today
MacOS Mojave, using Xcode 11 and iPhone Xs upgraded to iOS 13
Checklist
The text was updated successfully, but these errors were encountered: