To run the example project, clone the repo, and run pod install
from the Example directory first.
- Audio playback (local file and network stream)
- Video playback (local file and network stream)
- Chromecast stream
- Downloading and storing media files (playback occurs automatically from local file, if one is available)
- Convenient, KVO based mechanism for desplayinf playback info to user
- Shuffle
- Repeat queue (or repeat one track endlessly...)
- Background playback with built in interruptions (i.e. phone calls) management
- Displaying media info on lock screen
- Lock screen controls
AUMediaPlayer is a library allowing audio and video playback, both from network stream and local files. It features all the common stuff you may expect, like queues, shuffle, repeat. It has convenient progress observation mechanism based on KVO. It automatically sets media info for lock screen displaying and works with lock screen controls. It also manages interruptions. Library object is included as well. It allows to download and store media. Since then they are automatically played from local files.
From version 3.0 it also enables you to stream tracks from AUMediaLibrary to Chromecast.
AUMediaPlayer header files contain commented out code snippets, which allow you to setup whole playback mechanism quickly. Example project is also included.
Play item:
- (void)playItem:(id<AUMediaItem>)item error:(NSError * __autoreleasing *)error;
Play queue:
- (void)playItemQueue:(id<AUMediaItemCollection>)collection error:(NSError * __autoreleasing *)error;
Play another item from current queue:
- (void)playItemFromCurrentQueueAtIndex:(NSUInteger)index;
- (BOOL)tryPlayingItemFromCurrentQueue:(id<AUMediaItem>)item;
Control playback:
- (void)play;
- (void)pause;
- (void)stop;
- (void)playNext;
- (void)playPrevious;
Seek to specific moment (value from 0 to 1):
- (void)seekToMoment:(double)moment;
Set shuffle and repeat options:
- (void)setShuffleOn:(BOOL)shuffle;
- (void)setRepeatMode:(AUMediaRepeatMode)repeat;
- (void)toggleRepeatMode;
Download:
- (void *)downloadItem:(id<AUMediaItem>)item;
- (void)cancelDownloadForItem:(id<AUMediaItem>)item;
- (NSProgress *)progressObjectForItem:(id<AUMediaItem>)item;
- (void)downloadItemCollection:(id<AUMediaItemCollection>)collection;
Check status:
- (BOOL)itemIsDownloaded:(id<AUMediaItem>)item;
- (BOOL)itemCollectionIsDownloaded:(id<AUMediaItemCollection>)collection;
Get all items ot items from specific category (audio or video):
- (NSArray *)downloadingItems;
- (NSDictionary *)allExistingItems;
- (NSDictionary *)existingItemsForType:(AUMediaType)type;
Remove items:
- (void)removeItemFromLibrary:(id<AUMediaItem>)item error:(NSError * __autoreleasing*)error;
- (void)removeCollectionFromLibrary:(id<AUMediaItemCollection>)collecion error:(NSError * __autoreleasing*)error;
- (void)cleanLibraryError:(NSError * __autoreleasing*)error;
AUMediaPlayers requires ARC. Deployment target: iOS7. Requires AFNetworking dependency.
AUMediaPlayer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "AUMediaPlayer"
Thanks to AppUnite and @piotrbernad, who has authored the library class in major part.
lukasz.kasperek, [email protected]
AUMediaPlayer is available under the MIT license. See the LICENSE file for more info.