I am using AVCaptureMovieFileOutput
to record videos and I want to add a UIProgressView
to represent how much time there is left before the video stops recording.
I set a max duration of 15 seconds:
CMTime maxDuration = CMTimeMakeWithSeconds(15, 50);
[[self movieFileOutput] setMaxRecordedDuration:maxDuration];
I can't seem to find if AVCaptureMovieFileOutput
has a callback for when the video is recording or for when recording begins. My question is, how can I get updates on the progress of the recording? Or if this isn't something that is available, how can I tell when recording begins in order to start a timer?
Here is how I was able to add a
UIProgressView
recording
is a property ofAVCaptureFileOutput
which is extended byAVCaptureMovieFileOutput
I have a variable movieFileOutput of type
AVCaptureMovieFileOutput
that I am using to capture data to a QuickTime movie.I added an observer to the recording property to detect a change in recording.
Then in the callback method:
I created a while loop to be executed in the background, then I made sure to dispatch updates to the view on the main thread like this: