我能够通过以下这个问题 here斯威夫特IOS录制视频和音频AVFoundation
基本上
- 从
AVCaptureFileOutputRecordingDelegate
原型 - 循环继承可用的设备 成功抢录像
- 用相机创建会话
- 开始记录
- 停止录制
- 通过实施上述原型的方法
获取录制视频,但该文件不自带的音频。
据this问题,我不得不单独录制音频和使用提到的类
合并的视频和音频,但我不知道如何同时实现视频和音频录制。
for device in devices {
// Make sure this particular device supports video
if (device.hasMediaType(AVMediaTypeVideo)) {
// Finally check the position and confirm we've got the back camera
if(device.position == AVCaptureDevicePosition.Back) {
captureDevice = device as? AVCaptureDevice
if captureDevice != nil {
print("Capture device found")
beginSession()
}
}
}
}
在这个循环
唯一可用的设备类型是.Front和.Back