I'm trying to display the dimensions in which photos/video recordings can be taken to the user.
While photo dimensions are easily accessible through AVCaptureDevice.Format.highResolutionStillImageDimensions
, I have no idea how I can achieve the same for videos.
I've tried the AVCaptureDevice.Format.formatDescription.dimensions
property (or the .presentationDimensions(..)
func), but those just gave me the following compile errors:
Since those are available since iOS 13.0 (I believe that was Swift 5.1?), I should definitely have the API for those (especially since I can CMD + Click on them in my code), and my project should compile. Am I missing something here? Is there a better solution to get the resolution a capture device can record videos in?
You just need below line.That's it.
let dimensions = CMVideoFormatDescriptionGetDimensions(format.formatDescription)