ESAudioPlayer: A reactive audio player for iOS
ESAudioPlayer is a reactive audio player for iOS using RxSwift. It provides basic audio management features like playing an audio from a URL. And some more advanced features like queue management, MediaPlayer transport controls and now playing center info.
⚙️ Features
- Completely abstracted player details, only reactive layer is exposed for use
- Optimized performance for managing long queues
- Basic track management (Play, pause, resume)
- Queue management (Shuffle, repeat, next, previous, etc...)
- Speed management
- Seek forward, backwards or to a specific point
- Handle remote command center actions (Play, pause, next, previous, change playback position)
- Handle updating now playing center
📝 Requirements
- Swift version 5 or higher
- iOS 13 or higher
- Dependency on RxSwift as it's used to make player reactive
⬇️ Installation
ESAudioPlayer is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ESAudioPlayer'
📱 Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
🗝 How to use ESAudioPlayer?
- Use the
shared
instance ofESAudioPlayer
, creating a new instance is disabled. - Pass a track or a list of tracks to play through the
play(track:)
orplay(list:)
, which takeESPlayerAudioTrack
object. - Subscribe to the changes your interested in:
state
: Returns the player's current state (playing, buffering, paused, stopped, error)currentTrack
: Returns the track that is currently in the player (Whether it's playing or paused)queue
: Returns the queue that is currently in the playercurrentTime
: Returns the current position of the player in minutes and secondstrackDuration
: Returns the full time of the player in minutes and secondscurrentSpeed
: Returns the currently selected playback speedisRepeatOn
&isShuffleOn
: Returns whether the repeat or shuffle are turned on or not respectively
👨🏽💻 Author
Mario Mouris, mario.mouris@extremesolution.com
📄 License
ESAudioPlayer is available under the MIT license. See the LICENSE file for more info.