rick
rick

Reputation: 1057

Called Delegate Method after Stopping Recording Video

When I stop recording video manually, using stopRecording() method of an instance of AVCaptureMovieFileOutput, it will call fileOutput(_:didFinishRecordingTo:from:error:) delegate method of AVCaptureFileOutputRecordingDelegate. But when I stop video automatically using maxRecordedDuration, the captureOutput(captureOutput:didFinishRecordingToOutputFileAtURL:fromConnections:error:) delegate method will be called, that I couldn't find this method documentation on developer.apple.com website.

Also there is another method capture(_:didFinishRecordingToOutputFileAt:fromConnections:error:).

On AVCaptureFileOutputRecordingDelegate documentation there is only fileOutput methods and there is nothing about captureOutput or capture methods.

Is there a method that I handle the output file in it and will be called in any situations? so that I can handle the output in just one method.

Upvotes: 1

Views: 884

Answers (1)

MyCometG3
MyCometG3

Reputation: 207

I am not sure though it may be swift-api translation error. Some AVFoundation API have strange obj-c to swift api assignment.

From header file AVCaptureFileOutputRecordingDelegate has:

- (void)captureOutput:(AVCaptureFileOutput *)output didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray<AVCaptureConnection *> *)connections error:(nullable NSError *)error;

Swift api counterpart is:

func fileOutput(_ output: AVCaptureFileOutput, 
       didFinishRecordingTo outputFileURL: URL, 
       from connections: [AVCaptureConnection], 
      error: Error?)

I noticed both are different from your comment. Swift api correction may occure on SDK update. I recommend you to check SDK directory if it is SDK error.

Upvotes: 0

Related Questions