Protocol

AVAudioRecorderDelegate

The delegate of an AVAudioRecorder object must adopt the AVAudioRecorderDelegate protocol. All of the methods in this protocol are optional. They allow a delegate to respond to audio interruptions and audio decoding errors, and to the completion of a recording.

Topics

Responding to the Completion of a Recording

func audioRecorderDidFinishRecording(AVAudioRecorder, successfully: Bool)

Called by the system when a recording is stopped or has finished due to reaching its time limit.

Responding to an Audio Encoding Error

func audioRecorderEncodeErrorDidOccur(AVAudioRecorder, error: Error?)

Called when an audio recorder encounters an encoding error during recording.

Handling Audio Interruptions

func audioRecorderBeginInterruption(AVAudioRecorder)

Called when the audio session is interrupted during a recording, such as by an incoming phone call.

Deprecated
func audioRecorderEndInterruption(AVAudioRecorder, withOptions: Int)

Called after your audio session interruption ends, with options indicating the state of the audio session.

Deprecated
func audioRecorderEndInterruption(AVAudioRecorder)

Called after your audio session interruption ends.

Deprecated
func audioRecorderEndInterruption(AVAudioRecorder, withFlags: Int)

Called after your audio session interruption ends, with flags indicating the state of the audio session.

Deprecated

Relationships

Inherits From

See Also

Configuring and Controlling Recording

func prepareToRecord()

Creates an audio file and prepares the system for recording.

func record()

Starts or resumes recording.

func record(atTime: TimeInterval)

Starts recording at a specific time.

func record(forDuration: TimeInterval)

Records for a specified duration of time.

func record(atTime: TimeInterval, forDuration: TimeInterval)

Starts recording at a specified time for a specified duration of time.

func pause()

Pauses a recording.

func stop()

Stops recording and closes the audio file.

var delegate: AVAudioRecorderDelegate?

The delegate object for the audio recorder.

func deleteRecording()

Deletes a recorded audio file.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software