iPhone:5秒视频捕获 [英] iPhone: 5 seconds video capture
问题描述
我想编写代码,以便在用户按下按钮时,相机启动并记录5秒的视频。换句话说,我想有视频捕获,但有时间限制。
I would like to write code so that when the user presses a button, the camera is launched and records 5 seconds of video. In other words I want to have video capture but with a time limit.
在UIImagePickerController或框架的其他部分是否有什么东西允许这样做?谢谢。
Is there something inside the UIImagePickerController or other parts of the framework that would allow doing this? Thank you.
推荐答案
没有什么能让你直接这样做。但你可以很容易地使用UIImagePickerController的 startVideoCapture
开始捕获,然后调用 stopVideoCapture
5秒钟后, code> [picker performSelector:@selector(stopVideoCapture)withObject:nil afterDelay:5] 。
There is nothing that allows you to directly do this. But you can very easily use UIImagePickerController's startVideoCapture
to begin the capture and then call stopVideoCapture
5 seconds later, for example with [picker performSelector:@selector(stopVideoCapture) withObject:nil afterDelay:5]
.
与AVFoundation一样,特别是AVCaptureMovieFileOutput的 startRecordingToOutputFileURL:recordingDelegate:
和 stopRecording
方法。
Or you can do basically the same thing with AVFoundation, in particular AVCaptureMovieFileOutput's startRecordingToOutputFileURL:recordingDelegate:
and stopRecording
methods.
这篇关于iPhone:5秒视频捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!