Protocol

AVAudioRecorderDelegate

The delegate of an audio recorder object.

Declaration

protocol AVAudioRecorderDelegate

Overview

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() -> Bool

Creates an audio file and prepares the system for recording.

func record() -> Bool

Starts or resumes recording.

func record(atTime: TimeInterval) -> Bool

Starts recording at a specific time.

func record(forDuration: TimeInterval) -> Bool

Records for a specified duration of time.

func record(atTime: TimeInterval, forDuration: TimeInterval) -> Bool

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() -> Bool

Deletes a recorded audio file.