Reputation: 1522
we are trying to set a specific camera frame resolution in our iOS application (written in Objective-C) which is not defined in the AVCaptureSessionPreset. With the following code we would like to set the frame dimensions to a specific width:
for ( AVCaptureDeviceFormat *format in [self.camera formats] ) {
NSLog(@"%@", format);
CMVideoDimensions dim = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
if(dim.width == 3264){
if ([ self.camera lockForConfiguration:NULL] == YES) {
self.camera.activeFormat = format;
[ self.camera unlockForConfiguration];
}
}
}
However the resolution is set to 1920x1080 - which is a default value, i guess? Is there a specific order which defines when to call camera configurations?
Upvotes: 2
Views: 536
Reputation: 1486
You need to set the AVCaptureSessionPreset
property of AVCaptureSession
to AVCaptureSessionPresetInputPriority.
Upvotes: 3