【问题标题】:How to check if AVCaptureSession preset resolution is supported in Swift如何检查 Swift 中是否支持 AVCaptureSession 预设分辨率
【发布时间】:2018-02-24 16:53:19
【问题描述】:

例如,我可能想将其设置为 hd1280x720,但前提是它受支持,否则使用受支持的较低分辨率。

session = AVCaptureSession()
if(**my device supports hd1280x720**){
  session!.sessionPreset = AVCaptureSession.Preset.hd1280x720
}else if(**my device supports 640x480**){
  session!.sessionPreset = AVCaptureSession.Preset.vga640x480
}

【问题讨论】:

标签: swift camera resolution avcapturesession preset


【解决方案1】:

使用AVCaptureSession.canSetSessionPreset(_:):

返回一个布尔值,指示接收器是否可以使用给定的预设。

【讨论】:

    猜你喜欢
    • 2011-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 2016-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多