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
}
This may help you. If you get PHAssets with filtering by PHAssetCollectionSubtype.smartAlbumSelfPortraits, those assets seem to videos are taken in front camera.
Even though the video doesn't have faces, it is categorized as a selfie on iOS for now. I tested with iPhone 12 mini/ iOS15.
Apple also says like this:
https://developer.apple.com/documentation/photokit/phassetcollectionsubtype/smartalbumselfportraits
So maybe you can prefetch selfie album assets, then check if an asset is contained in the album to detect it is taken by the front camera.