Ios camera.activeFormat未被应用
我们正在尝试在iOS应用程序(用Objective-C编写)中设置AVCaptureSessionPreset中未定义的特定相机帧分辨率。使用以下代码,我们希望将框架尺寸设置为特定宽度:Ios camera.activeFormat未被应用,ios,objective-c,camera,avcapturesession,avcapturedevice,Ios,Objective C,Camera,Avcapturesession,Avcapturedevice,我们正在尝试在iOS应用程序(用Objective-C编写)中设置AVCaptureSessionPreset中未定义的特定相机帧分辨率。使用以下代码,我们希望将框架尺寸设置为特定宽度: for ( AVCaptureDeviceFormat *format in [self.camera formats] ) { NSLog(@"%@", format); CMVideoDimensions dim = CMVideoFormatDescriptionGetDimensio
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];
}
}
}
但是分辨率设置为1920x1080-我猜这是默认值?是否有定义何时调用相机配置的特定顺序?您需要将AVCaptureSession的sessionPreset属性设置为AVCaptureSessionPresetInputPriority。