react-native-image-crop-picker: Failed on select Video - IOS 14

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.35.0
  • react-native v0.63.2

Platform

Tell us to which platform this issue is related

  • iOS 14

Expected behaviour

Return video

Actual behaviour

Return error

Steps to reproduce

  1. Open picker

  2. Select video

  3. Return error

code:E_CANNOT_PROCESS_VIDEO
message:Cannot process video data
domain:RCTErrorDomain
userInfo:null

Attachments

When I’m trying to debug in xcode, exportSession always return status = 4 (AVAssetExportSessionStatusFailed), and the error look like this.

Video Export Failed: Error Domain=AVFoundationErrorDomain Code=-11800 “The operation could not be completed” UserInfo={NSUnderlyingError=0x2826f6730 {Error Domain=NSOSStatusErrorDomain Code=-16979 “(null)”}, NSLocalizedFailureReason=An unknown error occurred (-16979), NSURL=file:///var/mobile/Media/PhotoData/Metadata/DCIM/102APPLE/IMG_2272.medium.MP4, NSLocalizedDescription=The operation could not be completed}

[Update] I’m trying to select few files:

  1. file:///var/mobile/Media/PhotoData/Metadata/DCIM/102APPLE/IMG_2272.medium.MP4 (ERROR) // from whatsapp
  2. file:///var/mobile/Media/DCIM/100APPLE/IMG_0454.MOV (CORRECT) // save from instagram
  3. file:///var/mobile/Media/DCIM/102APPLE/IMG_2429.MOV (CORRECT) // save from camera
  4. file:///var/mobile/Media/PhotoData/Metadata/DCIM/102APPLE/IMG_2075.medium.MP4 (ERROR) // from whatsapp

Video with .MOV extension return success, but video with .MP4 return error.

Any idea why this issue exist and how to solve??

Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 17
  • Comments: 38 (10 by maintainers)

Most upvoted comments

Still issue for iCloud video. I use iOS 14.4 and version 0.35.3

macOS : You can make this node_modules change with sed -ie "s/options.networkAccessAllowed = YES;/options.networkAccessAllowed = YES; options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;/" node_modules/react-native-image-crop-picker/ios/src/ImageCropPicker.m;

How come this was solved for video and not photo? I have the same issue with iCloud photos – anyone else? I tried adding a similar fix as suggested above but I still have the same error:

- (void)qb_imagePickerController:
(QBImagePickerController *)imagePickerController
          didFinishPickingAssets:(NSArray *)assets {
    
    PHImageManager *manager = [PHImageManager defaultManager];
    PHImageRequestOptions* options = [[PHImageRequestOptions alloc] init];
    options.synchronous = NO;
    options.networkAccessAllowed = YES;
    options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat; <-- ADDED

@superandrew213 It works! @anhkieet Thanks a lot!

I’ve opened a PR #1515.

@ivpusic Can you merge?

It’s related to downloading images from iCloud.

iOS devices can choose to store a compressed version of the video/images locally but have a full version in the iCloud. When you choose to upload a video, it first gets the full version from iCloud and then tries the upload it.

When I try to upload a video that was recently viewed on my phone (which means the full version is already downloaded), there’s no problem. The problem occurs when it needs to download from iCloud

Still same issues for iCloud photos with version 0.36.0. @tufanlodos any thought?

@banchichen Can you make a PR?

It does seem related to iCloud. I didn’t realize I had Optimize Photos on until now

I tried with a video that was sent to me by whatsapp and I passed it to diaspositive and it doesn’t work so I don’t think it’s a problem of iCloud