[IOS 17] Bug when save video from URL and read it by PHPickerViewController

From IOS 17.

Have an issue when saving video and reading it from PHPickerViewController. Video become into jpeg file

Code save video and I saw reason because i changed creationDate. But IOS 16 no bug here

        doVertifyAccessAblum() {
            DispatchQueue.global(qos: .background).async {
                if let url = URL(string: videoURL), let urlData = NSData(contentsOf: url) {
                    let galleryPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0];
                    let filePath="\(galleryPath)/\(url.lastPathComponent).mp4"
                    
                    DispatchQueue.main.async {
                        urlData.write(toFile: filePath, atomically: true)

                        PHPhotoLibrary.shared().performChanges({
                            let changeRequest = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: URL(fileURLWithPath: filePath))
                            changeRequest?.creationDate = Date()
                        }) { success, error in
                            LOGGING.debug("Save video with status: success=\(success) error=\(String(describing: error))")
                        }
                    }
                }
            }
        }
    }
  • I created a repo to reproduce this bug: demo_bug_save_video

    Step to reproduce:

    Save video Open video from media picker See log error file video is jpeg file

  • DId you find the resolution now? I encountered the same case.

  • Not yet @Wangzai_ . I can't find a work-around solution so we should wait for the answer from @Frameworks Engineer .

Add a Comment

Replies

What exactly is the bug here? What code are you using to read it back and see it as an image as opposed to a video? Also if you've isolated this to a small project and filed a Feedback that would be helpful for understanding where the issue may be.

I created a repo to reproduce this bug: demo_bug_save_video

Step to reproduce:

  1. Save video
  2. Open video from media picker
  3. See log error file video is jpeg file