Starts recording media to the specified output URL.
- iOS 4.0+
- macOS 10.7+
- Mac Catalyst 13.0+
An object specifying the output file URL.
This method raises an
invalidif the argument isn’t a valid file URL.
A delegate object that’s notified of changes to the recording state.
A failure occurs if you attempt to record to a URL where a file exists. To overwrite the content, delete the old file before calling this method.
In macOS, calling this method from within the
capture method guarantees that the first samples written to the new file are those passed to the delegate method.
When you stop recording by calling
stop, by changing files using this method, or because of an error, the framework writes any remaining file data in the background. Therefore, for the system to notify you upon completion, you must adopt the
file delegate method. The recording delegate can also optionally implement methods that inform it when the output object starts writing data, when it pauses or resumes recording, and when it’s about to finish recording.
In macOS, you don’t need to call
stop before calling this method while another recording is in progress. If you call this method while the output object is recording, the framework preserves media samples between the old file and the new file. In iOS, to avoid any errors, you must call
stop before calling this method again.