I want to know whether is video is taken from the front or back camera. As info return nil.
let asset: PHAsset!
let manager = PHImageManager.default()
if asset.mediaType == .video {
let options: PHVideoRequestOptions = PHVideoRequestOptions()
options.version = .original
options.isNetworkAccessAllowed = true
manager.requestAVAsset(forVideo: asset, options: options) { (asset, audiomix, info) in
}
Surprisingly you are able to use PHImageManager.requestImageDataAndOrientation for VIDEO assets.
Observations
Upon serializing
ciImage.propertiesinto JSON, I got following results.1. Video (back camera)
2. Video (front camera)
3. Screenshot
4. Photo (has a TON of information and JSON serialization crashes, so I extracted only the "{Exif}" part)
The videos have
"ExifVersion":[2,2,1]while the photo has"ExifVersion":[2,3,1]. The videos' exif doesn't provide any useful information about camera at all - while photo's exif does. All of the videos & photos were captured on the same phone.At this point, still clueless if this information is even encoded into video frames at all.