IPhone: capture video in 5 seconds

I would like to write a code so that when the user clicks the button, the camera starts up 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 structure that would allow this to be done? Thanks.

+2
source share
1 answer

There is nothing that would allow you to do this directly. But you can very easily use the UIImagePickerController startVideoCapture to start capturing, and then call stopVideoCapture after 5 seconds, for example using [picker performSelector:@selector(stopVideoCapture) withObject:nil afterDelay:5] .

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

+3
source

Source: https://habr.com/ru/post/913554/


All Articles