react-native-image-crop-picker
react-native-image-crop-picker copied to clipboard
Rotated or edited video comes unedited in IOS.
Version
Tell us which versions you are using:
- react-native-image-crop-picker v0.35.3
- react-native v0.63.2
Platform
- iOS
Expected behaviour
Rotated video remains rotated while pick it from gallery.
Actual behaviour
Rotated video displayed as unrotated.
Similar behavior goes for audio, if you mute the video in iOS edit, picked file comes with audio, edit is lost regardless of the conversion setting. I managed to have a workaround getting localIdentifier with "Passthrough" (just so it does not waste too much time on conversion) and converting it using react-native-convert-ph-asset. I would bet it would help in your case as well, but have not tested that. Hope it helps. This library has an advantage - up to date conversion settings while other media pickers use some old implementations, if this could be fixed so it handles iOS edits correctly it would be a huge thing, unfortunately I have no idea how to fix such issue.
AFAIK it seems like Objective-C code actively asks for the unedited version:
https://github.com/ivpusic/react-native-image-crop-picker/blob/master/ios/src/ImageCropPicker.m#L467C23-L467C59
So I guess this is why it happens.
I wonder if there is any reason for this that I don't understand, but to me I would assume we want the last edited version, so instead request PHVideoRequestOptionsVersionCurrent
.
Trying a patch for this now!
UPDATE: Yes, changing this line:
options.version = PHVideoRequestOptionsVersionOriginal;
into
options.version = PHVideoRequestOptionsVersionCurrent;
Changed behaviour so the edited video is used - so rotations, mute sound etc is still there.