简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM