### AudioPlayer Delegate: Queue Management Source: https://github.com/delannoyk/audioplayer/blob/master/README.md Delegate method called just before a new audio item is about to start playing, allowing for pre-playback actions. ```swift func audioPlayer(audioPlayer: AudioPlayer, willStartPlayingItem item: AudioItem) ``` -------------------------------- ### Basic AudioPlayer Usage Source: https://github.com/delannoyk/audioplayer/blob/master/README.md Demonstrates the fundamental steps to initialize and play an audio item using the AudioPlayer library. Requires an AudioPlayerDelegate to be set. ```swift let delegate: AudioPlayerDelegate = ... let player = AudioPlayer() player.delegate = delegate let item = AudioItem(mediumQualitySoundURL: track.streamURL) player.playItem(item) ``` -------------------------------- ### Remote Control Events Handling Source: https://github.com/delannoyk/audioplayer/blob/master/README.md Objective-C code snippet demonstrating how to enable and receive remote control events for media playback, typically within an AppDelegate or UIResponder. ```objective-c - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application beginReceivingRemoteControlEvents]; return YES; } //Then in your UIResponder (or your AppDelegate if you will) - (void)remoteControlReceivedWithEvent:(UIEvent *)event { if let event = event { yourPlayer.remoteControlReceivedWithEvent(event); } } ``` -------------------------------- ### AudioPlayer Delegate: Duration and Progression Source: https://github.com/delannoyk/audioplayer/blob/master/README.md Delegate methods for receiving audio item duration and regular progression updates. The duration method is called once per item, while the progression method is called periodically. ```swift func audioPlayer(audioPlayer: AudioPlayer, didFindDuration duration: NSTimeInterval, forItem item: AudioItem) func audioPlayer(audioPlayer: AudioPlayer, didUpdateProgressionToTime time: NSTimeInterval, percentageRead: Float) ``` -------------------------------- ### AudioPlayer Delegate: State Changes Source: https://github.com/delannoyk/audioplayer/blob/master/README.md Callback method for the AudioPlayerDelegate protocol that is invoked when the player's state changes. It provides the previous and current states. ```swift func audioPlayer(audioPlayer: AudioPlayer, didChangeStateFrom from: AudioPlayerState, toState to: AudioPlayerState) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.