Instance Method

audioPlayerDidFinishPlaying(_:successfully:)

Called when a sound has finished playing.

Declaration

optional func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool)

Parameters

player

The audio player that finished playing.

flag

true on successful completion of playback; false if playback stopped because the system could not decode the audio data.

Discussion

This method is not called upon an audio interruption. Rather, an audio player is paused upon interruption—the sound has not finished playing.