ivpusic / react-native-image-crop-picker

iOS/Android image picker with support for camera, video, configurable compression, multiple images and cropping
MIT License
6.13k stars 1.56k forks source link

incorrect path with trimmed videos on IOS, it is not returning the correct path that I trimmed by from the phone gallery (ios) #1329

Open kevmmdev opened 4 years ago

kevmmdev commented 4 years ago

Version

Platform

Expected behaviour

I have trimmed videos on my phone, I trimmed using the Photo app of ios, when I select videos it should give me that path. Lets say the original video was 50 seconds, and then I trimmed that down to 10 seconds using the Photos app in IOS. This video btw can be retrimmed edited again with the app.

Actual behaviour

When I select videos its returning me the path of the untrimmed video which is the 50 second video. Which is incorrect, I need the 10 second video from my phone (ios)

Steps to reproduce

  1. Trim videos on your iphone
  2. select that video and on my end it returns me the incorrect path

Attachments

I already did some debugging of my own, I compared the returned path from the plugin react-native-image-picker since it was returning the correct path.

This is an exaple of the path from react-native-image-picker: file:///Users/myName/Library/Developer/CoreSimulator/Devices/E3A60B4F-6DE8-44BE-ADD5-E9505D934D6F/data/Containers/Data/Application/BD0E222C-6A6F-438E-B7EF-E508FF821DAC/tmp/trim.BE31A72F-A9D7-42A0-8841-7626F413CE42.MOV

This is the path being return by this library: "file:///Users/myName/Library/Developer/CoreSimulator/Devices/E3A60B4F-6DE8-44BE-ADD5-E9505D934D6F/data/Containers/Data/Application/BD0E222C-6A6F-438E-B7EF-E508FF821DAC/tmp/react-native-image-crop-picker/58146D72-081F-4DA3-81DB-7CB684801D82.mp4

So what I suspect this is the one missing "trim.BE31A72F-A9D7-42A0-8841-7626F413CE42.MOV"

NishidaRyu416 commented 4 years ago

I have experienced that issue too. I think that is even happening for images.

GeorgyMishin commented 4 years ago

 @electricfeel1979 It depends on the fact that the getVideoAsset function in the PHVideoRequestOptions options uses the PHVideoRequestOptionsVersionOriginal version, which returns the original video. I think PHVideoRequestOptionsVersionCurrent can solve this problem

https://developer.apple.com/documentation/photokit/phvideorequestoptions/1616970-version?language=objc

ArkaneKhan commented 3 years ago

I am experiencing this issue too.

superandrew213 commented 3 years ago

For videos we need to include PHVideoRequestOptionsVersionCurrent. Right now we are only using PHVideoRequestOptionsVersionOriginal.

For images we need to include UIImagePickerControllerEditedImage. Right now we are only using UIImagePickerControllerOriginalImage.

@ivpusic What do you think is the best way to add this? Let user decide if they want to import original or current (edited) version of media? E.g. add version = original | current option to request object?

ArkaneKhan commented 3 years ago

It would be best to let user decide whether to pick original or edited.

On Fri, Jul 23, 2021 at 5:14 AM Andrew Shini @.***> wrote:

For videos we need to include PHVideoRequestOptionsVersionCurrent. Right now we are only using PHVideoRequestOptionsVersionOriginal.

For images we need to include UIImagePickerControllerEditedImage. Right now we are only using UIImagePickerControllerOriginalImage.

@ivpusic https://github.com/ivpusic What do you think is the best way to add this? Let user decide if they want to import original or current (edited) version of media? E.g. add version = original | current option to request object?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ivpusic/react-native-image-crop-picker/issues/1329#issuecomment-885317334, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA4AY4I2Y7JWCDPALZZFPLTZCX63ANCNFSM4OMBO3PQ .

vuthanhtrung0504 commented 3 years ago

I have this issue too. How to resolve this?

jehartzog commented 3 years ago

here is a patch-package we confirmed fixes the issue for us. Thanks @superandrew213 for the tips on what to replace.

Our patch includes an additional enhancement from here, so be aware if you're dropping it in.