iPhone: 5 seconds video capture

我们两清 提交于 2019-12-24 01:44:56

问题


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.

Is there something inside the UIImagePickerController or other parts of the framework that would allow doing this? Thank you.


回答1:


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].

Or you can do basically the same thing with AVFoundation, in particular AVCaptureMovieFileOutput's startRecordingToOutputFileURL:recordingDelegate: and stopRecording methods.



来源:https://stackoverflow.com/questions/5838774/iphone-5-seconds-video-capture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!