Xam.Plugin.Media PickVideo crash on iOS 13

When choosing to pick a video from the gallery, the video is compressed but then the app crashes, with the exception saying access to the path denied. This looks to be only a bug on iOS 13.
I have followed the sample code how to use Xam.Plugin.Media and the app crashes on the below line
I am on the latest stable version of Xam.Plugin.Media 4.0.1.5
await CrossMedia.Current.PickVideoAsync();

The pick video option doesn't ask for an app name and directory name, this maybe the cause for the crash?
I have these permissions in my info.plist

NSCameraUsageDescription
This app needs access to the camera to take photos.
NSPhotoLibraryUsageDescription
This app needs access to photos.
NSMicrophoneUsageDescription
This app needs access to microphone.
NSPhotoLibraryAddUsageDescription
This app needs access to the photo gallery.

Answers

  • ColeXColeX Member, Xamarin Team Xamurai
    edited September 19

    I searched recent issue on github but did not find the similar case as yours , consider opening a new issue and it's better to attach the reproduction .

  • RobertDalyRobertDaly USMember ✭✭

    I received the same error and have seen other developers that have witnessed this. In my debug log I can pin-point the exception. It occurs when I retrieve a video from Photos and try to copy it to my local folder. This has always worked in every version prior to iOS 13.

    In my code, I merely do a copy of the .MOV file to my local folder. Don't have a clue as to why they changed it, but apparently is is using .../PluginKitPlugin as part of the path which was not used prior to this. This issue only affects videos - still images work fine (and they don't use the .../PluginKitPlugin.
    "Access to the path '/private/var/mobile/Containers/Data/PluginKitPlugin/63628C1F-5B66-4C40-ACF8-6B8F8E873254/tmp/trim.482CB0A5-ED17-4787-85E7-3543769A4054.MOV' is denied."

    I am searching for a work around. Are you (or have you) opened a new issue about this?

  • RobertDalyRobertDaly USMember ✭✭

    My solution worked. In my code I was using System.IO.File.Move(src, dest). Move does try to delete the original src, and I believe that is what is causing the exception. I changed the call to System.IO.File.Copy(src, dest) and all is right in the world! This happens if you are using Xam.Plugin.Media. Hope this helps you.

Sign In or Register to comment.