Save Video Using AVFoundation Swift

后端 未结 6 1544
感情败类
感情败类 2021-02-05 08:57

Hi I followed a course by Jared Davidson to create a custom camera view and save pictures using AVFoundation. https://www.youtube.com/watch?v=w0O3ZGUS3pk

However I would

6条回答
  •  我在风中等你
    2021-02-05 09:27

    after if (device as AnyObject).position == AVCaptureDevicePosition.front{

    add

    // Audio Input
                    let audioInputDevice = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeAudio)
    
                    do
                    {
                        let audioInput = try AVCaptureDeviceInput(device: audioInputDevice)
    
                        // Add Audio Input
                        if captureSession.canAddInput(audioInput)
                        {
                            captureSession.addInput(audioInput)
                        }
                        else
                        {
                            NSLog("Can't Add Audio Input")
                        }
                    }
                    catch let error
                    {
                        NSLog("Error Getting Input Device: \(error)")
                    }
    

    Thanks

提交回复
热议问题