What are all AVCaptureSessionPresetHigh resolutions for rear and front cameras?

As a preset, AVCaptureSessionPresetHighit makes a lot of sense to me. The hardware is always changing, and it makes sense to be able to tell AVCapture that "I want the highest quality you can give me, given the current hardware." What turns me on, but just because I want to set the session to an abstract value does not mean that I do not need to know the resolution that it displays.

The only way to find out the current resolution is to actually capture the frame and check the size of the specified frame. Or, even worse, manually find all these permissions, create a search dictionary, ask the device for its model, and then extract a hard-coded resolution. This is a complete hack, but still better than forcing the capture of a frame and then requesting UIImage for its frame size.

I desperately need this information to make dynamic decisions based on the aspect ratio that the camera provides. Why doesn't the apple have an interface for such a simple request?

Does anyone know of a resource that lists all the possible resolutions for both cameras on the entire Apple hardware market? I can skip my path through some, but I cannot find a complete list.

+4
source share
1 answer

Given AVCaptureDevice, you should be able to list in formatsor research activeFormat, and then look at what you highResolutionStillImageDimensionsreceived AVCaptureDeviceFormat.

+2
source

Source: https://habr.com/ru/post/1570372/


All Articles