I need to know if the video I am playing from the web through AVURLAsset is portrait or landscape.
In the past I have done this with local videos by getting the video track's natural size, applying its preferred transform, and then comparing width and height. Example:
if let assetTrack = asset.tracks(withMediaType: AVMediaType.video).first {
let temp = assetTrack.naturalSize.applying(assetTrack.preferredTransform)
let size = CGSize(width:fabs(temp.width), height: fabs(temp.height))
return size.height > size.width
}
But for this streamed video, asset.tracks
is empty, so I can't check the natural size.
Does anyone know how to resolve this?