Actually you can do it with any device that can record video:
- Create and configure a
AVCaptureVideoDataOutput
.
- Add it to your
AVCaptureSession
.
- Add a
AVCaptureVideoDataOutputSampleBufferDelegate
.
- Implement
captureOutput:didOutputSampleBuffer:fromConnection:
in the delegate and get the image with imageFromSampleBuffer:
.
Some similar code can be found here, where images are captured at a given interval, but you only want one image.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…