0
Я использую это, чтобы захватить изображениеКак захватить видео в iOS (CUSTOM)?
var captureDevice : AVCaptureDevice?
var picker = UIImagePickerController()
var captureSession = AVCaptureSession()
var stillImageOutput = AVCaptureStillImageOutput()
var captureVideoPreviewLayer = AVCaptureVideoPreviewLayer()
func captureImage (sender:AnyObject?) {
isCapturingImage = true
var videoConnection :AVCaptureConnection? = nil
for connection:AVCaptureConnection in stillImageOutput.connections as! [AVCaptureConnection] {
for port:AVCaptureInputPort in connection.inputPorts as! [AVCaptureInputPort]{
if(port.mediaType == AVMediaTypeVideo){
videoConnection = connection
break;
}
}
if((videoConnection) != nil) {break}
}
stillImageOutput.captureStillImageAsynchronouslyFromConnection(videoConnection, completionHandler: {
(imageSampleBuffer:CMSampleBufferRef! , error :NSError!) in
if (imageSampleBuffer != nil) {
var imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageSampleBuffer)
let capturedImage = UIImage.init(data: imageData, scale:1)
}
})
}
Как я осуществлять захват видео? Я вряд ли могу найти учебник по пользовательскому захвату видео. Любой может реализовать функцию захвата видео?