How to get front camera, back camera and audio with AVCaptureDeviceDiscoverySession

后端 未结 11 1389
闹比i
闹比i 2020-12-12 20:58

Before iOS 10 came out I was using the following code to get the video and audio capture for my video recorder:

 for device in AVCaptureDevice.devices()
 {
          


        
11条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-12 21:10

    It works on Xcode 9.2 and Swift 4

    AVCaptureDevice.default(.builtInWideAngleCamera, for: AVMediaType.video, position: .back)
    

    https://developer.apple.com/documentation/avfoundation/avcapturedevice/2361508-default

提交回复
热议问题