SCLTAudioPlayer 0.1.1

SCLTAudioPlayer 0.1.1

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.

  • By
  • Scarlet

SCLTAudioPlayer is the playback the core of ShufflePlus. It's an extension of AVAudioPlayer and is intended to simplify the process of playing audio. It is primarily intended for playing audio from the local media library, but is also capable of playing remote assets.

SCLTAudioPlayer requires iOS 7.0 or greater.


SCLTAudioPlayer is easiest installed with CocoaPods. Just add this to your podfile:

platform :ios, '7.0'
pod "SCLTAudioPlayer", "~> 0.1.0"

Getting Started

As a basic example, here's how to play a single track from the media library:

// Fetch a list of all the songs on a device
MPMediaQuery *songsQuery = [MPMediaQuery songsQuery];
self.songs = [songsQuery items]; 

// We want to play the first one
MPMediaItem *song = self.songs[0];

// Play it!
SCLTMediaItem *mediaItem = [[SCLTMediaItem alloc] initWithMediaItem:song];
[[SCLTAudioPlayer sharedPlayer] setPlaylist:@[mediaItem]];
[[SCLTAudioPlayer sharedPlayer] play];

Background Support

SCLTAudioPlayer also supports background playback, and responds to remote control events. You can also execute arbitrary code in the background on a number of different events by registering a delegate with the player.

To set up background playback, you'll need to add some code to your app delegate:

    return YES;

- (void)remoteControlReceivedWithEvent:(UIEvent*)receivedEvent{
    if (receivedEvent.type == UIEventTypeRemoteControl) {
        [[SCLTAudioPlayer sharedPlayer] handleRemoteControlEvent:receivedEvent];

You'll of course also need to enable background audio in the Capabilities tab of your app settings:

Enabling background audio in Xcode