func setSessionPreset()

in react-native-pytorch-core/ios/Camera/CameraView.swift [76:92]


    func setSessionPreset() {
        if let captureSession = captureSession,
           let width = (targetResolution["width"] as? NSNumber)?.intValue,
           let height = (targetResolution["height"] as? NSNumber)?.intValue {
            if (width <= 288 && height <= 352) {
                captureSession.sessionPreset = .cif352x288
            } else if (width <= 480 && height <= 640) {
                captureSession.sessionPreset = .vga640x480
            } else if (width <= 720 && height <= 1280) {
                captureSession.sessionPreset = .hd1280x720
            } else if (width <= 1080 && height <= 1920) {
                captureSession.sessionPreset = .hd1920x1080
            } else {
                captureSession.sessionPreset = .hd4K3840x2160
            }
        }
    }