IOS 8 Swift Audio Playback Execute method on completion

I am playing an audio file in Swift for iOS 8. I need to know when the audio is finished. How can I execute the method when the sound is finished?

+3


source to share


1 answer


It depends on how you play. Find a delegate method, notification, or observable property whose state change can trigger a KVO notification.



For example, if you are using AVAudioPlayer, it delegate

is notified by the delegate method, which you can check here: https://developer.apple.com/library/ios/documentation/avfoundation/reference/AVAudioPlayerDelegateProtocolReference/index.html#//apple_ref/doc / uid / TP40008068

+3


source







All Articles