UnityNativeGallery
UnityNativeGallery copied to clipboard
iOS: Get original filename instead of PickedMedia1 etc
Description of the bug User selects file (e.g. Video1.mp4) The returned path from the plugin has the filename pickedMedia1.mp4
Platform specs
- Unity version: 2019 LTS
- Platform: iOS
- Device: iPhone Xs, iOS 14.6
- How did you download the plugin: UPM (github)
For reference: https://stackoverflow.com/questions/37383491/get-original-video-name-as-selected-from-uiimagepickercontroller
At the moment, I'm not planning to implement this feature. I can't anyways because I don't have access to my Mac workstation and I'd need to have at least one iOS 14+ device and one iOS 13- device.
In NativeGallery.mm, you'll need to change most of the lines with pickedMediaSavePath:
- Inside
(PHPickerViewController *)picker didFinishPickingfunction (iOS 14+), you need to determine the filename from itemProvider.suggestedName (I don't know if it can be null, so you should check for null values, as well) - Inside
(UIImagePickerController *)picker didFinishPickingMediaWithInfofunction (iOS 13-), you can use the method suggested in the stackoverflow entry you've posted