Module: AVAudioPlayerDelegate
Overview
The delegate of an AVAudioPlayer object must adopt the AVAudioPlayerDelegate 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 sound’s playback.Called when an audio player is interrupted, such as by an incoming phone call.Called when an audio player encounters a decoding error during playback.Called when a sound has finished playing.Called after your audio session interruption ends, with options indicating the state of the audio session.
Instance Method Summary (collapse)
-
- audioPlayerBeginInterruption:
Called when an audio player is interrupted, such as by an incoming phone call.
-
- audioPlayerDecodeErrorDidOccur:error:
Called when an audio player encounters a decoding error during playback.
-
- audioPlayerDidFinishPlaying:successfully:
Called when a sound has finished playing.
-
- audioPlayerEndInterruption:withOptions:
Called after your audio session interruption ends, with options indicating the state of the audio session.
Instance Method Details
- (Object) audioPlayerBeginInterruption(player)
Called when an audio player is interrupted, such as by an incoming phone call. Upon interruption, your application’s audio session is deactivated and the audio player pauses. You cannot use the audio player again until you receive a notification that the interruption has ended.
- (Object) audioPlayerDecodeErrorDidOccur(player, error:error)
Called when an audio player encounters a decoding error during playback.
- (Object) audioPlayerDidFinishPlaying(player, successfully:flag)
Called when a sound has finished playing. This method is not called upon an audio interruption. Rather, an audio player is paused upon interruption—the sound has not finished playing.
- (Object) audioPlayerEndInterruption(player, withOptions:flags)
Called after your audio session interruption ends, with options indicating the state of the audio session. 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 player. To resume playback, call the play method.If this delegate method receives the AVAudioSessionInterruptionOptionShouldResume constant in its options parameter, the audio session is immediately ready to be used.