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 .