AVAudioRecorderDelegate Protocol Reference
| Conforms to | |
| Framework | /System/Library/Frameworks/AVFoundation.framework |
| Availability | Available in iOS 3.0 and later. |
| Declared in | AVAudioRecorder.h |
Overview
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.
Tasks
Responding to the Completion of a Recording
Responding to an Audio Encoding Error
Handling Audio Interruptions
-
– audioRecorderBeginInterruption: -
– audioRecorderEndInterruption:withOptions: -
– audioRecorderEndInterruption:Deprecated in iOS 6.0 -
– audioRecorderEndInterruption:withFlags:Deprecated in iOS 6.0
Instance Methods
audioRecorderBeginInterruption:
Called when the audio session is interrupted during a recording, such as by an incoming phone call.
Parameters
- recorder
The audio recorder whose recording was interrupted.
Discussion
Upon interruption, your application’s audio session is deactivated and the audio recorder pauses. You cannot use the audio recorder again until you receive a notification that the interruption has ended.
Availability
- Available in iOS 3.0 and later.
Declared In
AVAudioRecorder.haudioRecorderDidFinishRecording:successfully:
Called by the system when a recording is stopped or has finished due to reaching its time limit.
Parameters
- recorder
The audio recorder that has finished recording.
- flag
TRUEon successful completion of recording;FALSEif recording stopped because of an audio encoding error.
Discussion
This method is not called by the system if the audio recorder stopped due to an interruption.
Availability
- Available in iOS 3.0 and later.
Declared In
AVAudioRecorder.haudioRecorderEncodeErrorDidOccur:error:
Called when an audio recorder encounters an encoding error during recording.
Parameters
- recorder
The audio recorder that encountered the encoding error.
- error
The encoding error.
Availability
- Available in iOS 3.0 and later.
Declared In
AVAudioRecorder.haudioRecorderEndInterruption:withOptions:
Called after your audio session interruption ends, with options indicating the state of the audio session.
Parameters
- recorder
The paused audio recorder whose interruption has ended.
- flags
Options indicating the state of the audio session when this method is called. Options are described in AVAudioSessionInterruptionOptions
Discussion
For an audio recorder’s delegate to receive this message, the audio recorder must have been recording when the interruption started. When an interruption ends, such as by a user ignoring an incoming phone call, the audio session for your application is automatically reactivated; at that point you can again interact with the audio recorder. To resume recording, call the record method.
If this delegate method receives the AVAudioSessionInterruptionOptionShouldResume constant in its flags parameter, the audio session is immediately ready to be used.
Availability
- Available in iOS 6.0 and later.
Declared In
AVAudioRecorder.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)