问题
I have a one .MOV file and one .JPG file. When I'm trying to make a Live Photo:
func makeLivePhotoFromItems(imageURL: NSURL, videoURL: NSURL, previewImage: UIImage, completion: (livePhoto: PHLivePhoto) -> Void) {
PHLivePhoto.requestLivePhotoWithResourceFileURLs([imageURL, videoURL], placeholderImage: previewImage, targetSize: CGSizeZero, contentMode: PHImageContentMode.AspectFit) {
(livePhoto, infoDict) -> Void in
print("info: \(livePhoto)")
if let lp = livePhoto {
completion(livePhoto: lp)
}
}
}
And making like this:
makeLivePhotoFromItems(url, videoURL: movURL, previewImage: UIImage(named: "preview")!) { (livePhoto) in
}
its not working. Live photo not creating and console writes:
info: Optional(<PHLivePhoto: 0x10077f660>)
complete
info: Optional(<PHLivePhoto: 0x10143ef30>)
complete
2016-05-03 13:23:18.191 LivePhoto[2170:982987] Error: Invalid video metadata
info: nil
I am really hopes, that you can help me.
回答1:
the image and mov file must have the same identifier(NSString *assetIdentifier = [[NSUUID UUID] UUIDString]),and the key of mov in metadata must be @"com.apple.quicktime.content.identifier"
来源:https://stackoverflow.com/questions/37001612/how-to-make-phlivephoto-from-mov-file