Apart from some videos not being able to be picked as noted in #137 , now when deploying to iOS TestFlight, no video is able to be picked with the following exception thrown.
This would imply the plugin does not work on iOS entirely for picking videos.
Images work fine.
I've tried over 10 different videos with the same error.
FileSystemException: FileSystemException: Cannot copy file to '/var/mobile/Containers/Data/Application/F6DDCCC4-A01D-4D9F-A076-A5A47733675A/Documents/7c6a7d60-bda3-4438-8364-9e78e28811e7trim.397B5D0B-2333-4DCB-95E0-9E81D4FCF5EB.MOV', path = '/private/var/mobile/Containers/Data/PluginKitPlugin/AFBB7504-5D0F-4A7D-A4F0-3C0EC0FCD440/tmp/trim.397B5D0B-2333-4DCB-95E0-9E81D4FCF5EB.MOV' (OS Error: No such file or directory, errno = 2)
File "create_post.dart", line 605, in OBSavePostModalState._onError
File "async_patch.dart", line 43, in _AsyncAwaitCompleter.start
File "create_post.dart", line 589, in OBSavePostModalState._onError
File "create_post.dart", line 406, in OBSavePostModalState._getImagePostActions.<fn>
File "async_patch.dart", line 78, in _asyncErrorWrapperHelper.<fn>
File "zone.dart", line 1144, in _rootRunBinary
File "zone.dart", line 1037, in _CustomZone.runBinary
File "future_impl.dart", line 151, in _FutureListener.handleError
File "future_impl.dart", line 690, in Future._propagateToListeners.handleError
File "future_impl.dart", line 711, in Future._propagateToListeners
File "future_impl.dart", line 530, in Future._completeError
File "async_patch.dart", line 36, in _AsyncAwaitCompleter.completeError
File "media.dart", line 0, in MediaService.pickVideo
File "async_patch.dart", line 78, in _asyncErrorWrapperHelper.<fn>
File "zone.dart", line 1144, in _rootRunBinary
File "zone.dart", line 1037, in _CustomZone.runBinary
File "future_impl.dart", line 151, in _FutureListener.handleError
File "future_impl.dart", line 690, in Future._propagateToListeners.handleError
File "future_impl.dart", line 711, in Future._propagateToListeners
File "future_impl.dart", line 522, in Future._completeWithValue
File "future_impl.dart", line 552, in Future._asyncComplete.<fn>
File "zone.dart", line 1124, in _rootRun
File "zone.dart", line 1021, in _CustomZone.run
File "zone.dart", line 923, in _CustomZone.runGuarded
File "zone.dart", line 963, in _CustomZone.bindCallbackGuarded.<fn>
File "schedule_microtask.dart", line 41, in _microtaskLoop
File "schedule_microtask.dart", line 50, in _startMicrotaskLoop
Oof.. think I might have figured out why.. Sorry for the eager reporting. Will close and reopen if still an issue after changing something.
Did some more digging. Wasn't related to trying to copy the file which I thought it was.
The picked video file is for some reason not allowed to be read.
2019-09-21 13:03:45.665974+0200 Runner[1789:1003530] flutter: Caught error: FileSystemException: Cannot open file, path = '/private/var/mobile/Containers/Data/PluginKitPlugin/AFBB7504-5D0F-4A7D-A4F0-3C0EC0FCD440/tmp/trim.727077C2-549D-4B77-A93A-DDE759B0890E.MOV' (OS Error: Operation not permitted, errno = 1)
I did update my phone yesterday to iOS 13, so perhaps related?
@lifenautjoe yes, there could be some issues related with iOS 13 because I've found a few also with image_picker that throws an error exactly when trying to pick a video from the gallery (the procedure is the same). However, I'm not able to pick _any_ video with iOS 13 right now from gallery. Does that happen as well to you?
I'll leave this open until I deploy a fix for it. It shouldn't take long, if I have sometime maybe even this weekend.
Thank you.
Yep, same issue here, can't pick any videos. Was breaking my head over it. Thanks for letting me know you've also spotted it and even better to know you're on it!
If you have a buy me a coffee page we would be happy to send you some coffees your way!
Thanks for the great library!
Ahah thank you @lifenautjoe, good point. I definitely need some coffee, must add one button for it. 鈽曪笍
I鈥檒l keep you updated.
@lifenautjoe oddly when running now, after updating Xcode, without changing anything, it picks videos just fine. Looks like a build issue, actually. Have you tried to build with latest public Xcode version?
I'll give it a go. I tried running it under the beta version unsuccessfully. You have that one or did you receive an update for XCode to support iOS 13? 馃
@lifenautjoe I'm not on any beta version. My Xcode just received an update (check your AppStore) to version 11.0 which has iOS 13 support.
Let me know if it worked for you after updating @lifenautjoe.
Hi Miguel,
I've updated to XCode 11. Apart from not being able to build the app with flutter run due to https://github.com/flutter/flutter/issues/37699 , I am still not able to pick any video.
Sorry to bring the bad news 馃槵
Update: Upgraded flutter to master where the previously mentioned issue was fixed. Launched it with flutter run still get the same error.
@lifenautjoe does that happen only with a real device, simulator or both? It seems that with simulator (running iOS 13 as well) it runs just fine. Could you please check that?
Testing it now but can't seem to find a way to get a video onto the simulator to pick.
@lifenautjoe just drag & drop the file into it. 馃槃
Ah... so simple 馃う鈥嶁檪 .
I've tried now and freezes on the "Compressing video" message after picking an item on the simulator.
@lifenautjoe hum... that's weird. Could you please try with a small video just to make sure? It's always harder when I can't replicate other's issues. 馃槥 When I pick with simulator everything works as it should, but I haven't been able to try with a real device yet.
I'm not sure if this might help, but there's no issues with picking videos from the camera with the image_picker plugin pickVideo option.
@lifenautjoe by looking at your vide it looks like you're using the image_picker plugin and not the file_picker and yes, image_picker has currently an issue with iOS 13 exactly like you described: it works well with camera, but fails when picking from gallery.
I'm using both, I'm using yours to do the video picking and image_picker to take video captures.
This is because we allow picking multiple images, therefore the mix of the two.
List<Widget> videoPickerActions = [
ListTile(
leading: const OBIcon(OBIcons.gallery),
title: OBText(
localizationService.video_picker__from_gallery,
),
onTap: () async {
File file = await FilePicker.getFile(type: FileType.VIDEO);
Navigator.pop(context, file);
},
),
ListTile(
leading: const OBIcon(OBIcons.camera),
title: OBText(
localizationService.video_picker__from_camera,
),
onTap: () async {
File pickedVideo =
await ImagePicker.pickVideo(source: ImageSource.camera);
Navigator.pop(context, pickedVideo);
},
)
];
@lifenautjoe ok thank you. So, it looks like it's happening with both plugins right? Which somehow makes sense.
Was reading through it too.
Seems to be this
The issue may be connected to the lifetime of the url, which is extant with the lifetime of the image picker delegate. If the image picker delegate is deallocated, the url is invalidated. So if you need access to the image or video after the image picker delegate goes away, you need to copy it to a more permanent location. I had a similar issue after the update to iOS 13 / Xcode 11.
@lifenautjoe I can't reproduce the issue as it is working right now properly with the simulator on iOS 13, just tried it right now. I couldn't test it with a device yet.
@lifenautjoe never mind, I believe I was able to reproduce the issue and please confirm that it only happens with video files and not with images. I've deployed a fix in beta, could you please give it a try and let me know if it is working for you?
Just replace your file_picker dependency in the pubspec with the following:
file_picker:
git:
url: https://github.com/miguelpruivo/plugins_flutter_file_picker.git
ref: beta
and do a flutter clean just to make sure before rebuilding.
Thank you!
It works Miguel. Outstanding work! Thank you for looking into this faster than the flutter team could 馃檴.
Let me know if you want to see your library in action in our app ( https://okuna.io ), it's a social network and we've got videos working now 馃槑 .
@lifenautjoe I thank you for quickly reporting this. It has now landed on pub.dev (1.4.2), you can use it normally (file_picker: ^1.4.2).
Thank you, definitely got to give a look into okuna! 馃槂
Most helpful comment
Yep, same issue here, can't pick any videos. Was breaking my head over it. Thanks for letting me know you've also spotted it and even better to know you're on it!
If you have a buy me a coffee page we would be happy to send you some coffees your way!
Thanks for the great library!