Choosing the right AVCaptureSessionPreset for different devices

前端 未结 2 378
無奈伤痛
無奈伤痛 2021-01-27 03:57

I am a little confused which preset I should use for different devices. Currently I am using AVCaptureSessionPresetMedium for all devices. However, I want to take a

2条回答
  •  走了就别回头了
    2021-01-27 04:36

    you can use like below.

    [CaptureSession setSessionPreset:AVCaptureSessionPresetMedium];
    if ([CaptureSession canSetSessionPreset:AVCaptureSessionPreset640x480])     //Check size based configs are supported before setting them
            [CaptureSession setSessionPreset:AVCaptureSessionPreset640x480];
    if ([CaptureSession canSetSessionPreset:AVCaptureSessionPreset1280x720])
            [CaptureSession setSessionPreset:AVCaptureSessionPreset1280x720];
    if ([CaptureSession canSetSessionPreset:AVCaptureSessionPreset1920x1080])
            [CaptureSession setSessionPreset:AVCaptureSessionPreset1920x1080];
    if ([CaptureSession canSetSessionPreset:AVCaptureSessionPreset3840x2160])
            [CaptureSession setSessionPreset:AVCaptureSessionPreset3840x2160];
    

    or you can use just one statement

    [CaptureSession setSessionPreset:AVCaptureSessionPresetHigh];
    

提交回复
热议问题