[Solved] How to tell if a video is HDR or not in Swift?


Simple and precise:

var isHdrVideo = false
    let pVideoTrack = AVAsset(url: URL(fileURLWithPath: assetURL!))
    if #available(iOS 14.0, *) {
        let tracks = pVideoTrack.tracks(withMediaCharacteristic: .containsHDRVideo)
        for track in tracks{
            isHdrVideo = track.hasMediaCharacteristic(.containsHDRVideo)
            if(isHdrVideo){
                break
            }
        }
    }

solved How to tell if a video is HDR or not in Swift?