ColiseuPlayer
ColiseuPlayer is an audio player framework written in Swift, created for Coliseu app. It uses AVFoundation.
Usage
import AVFoundation
import ColiseuPlayer
class ViewController: UIViewController, ColiseuPlayerDataSource, ColiseuPlayerDelegate {
let player = ColiseuPlayer()
override func viewDidLoad() {
super.viewDidLoad()
self.player.startSession()
self.player.dataSource = self
var list = [AudioFile]()
if let path = Bundle.main.path(forResource: "sampleAudio", ofType: "m4a") {
let urlFile = URL(fileURLWithPath: path)
let audio = AudioFile(url: urlFile)
audio.artwork = UIImage(named: "image-cover-artwork")
list.append(audio)
}
if list.count > 0 {
// Play first song (it will continue playing with the current playlist)
player.playSong(index: 0, songsList: list)
}
}
override func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated)
self.player.stopSession()
}
override func remoteControlReceived(with event: UIEvent?) {
self.player.didReceiveRemoteControl(event: event)
}
func audioRepeatType(in player: ColiseuPlayer) -> ColiseuPlayerRepeat {
return .all
}
func audioWillShuffle(in player: ColiseuPlayer) -> Bool {
return true
}
}
Requirements
- iOS 8.0+
- Xcode 10.2+
Installation
Carthage
To install it, simply add the following line to your Cartfile:
github "ricardopereira/ColiseuPlayer"
Then run carthage update
.
Follow the current instructions in Carthage's README for up to date installation instructions.
CocoaPods
To install it, simply add the following line to your Podfile:
pod 'ColiseuPlayer'
You will also need to make sure you're opting into using frameworks:
use_frameworks!
Then run pod install
with CocoaPods 0.36 or newer.
Manually
ColiseuPlayer in your project requires the following steps:_
- Add ColiseuPlayer as a submodule by opening the Terminal,
cd
-ing into your top-level project directory, and entering the commandgit submodule add https://github.com/ricardopereira/coliseu.ios.player.git
- Open the
ColiseuPlayer
folder, and dragColiseuPlayer.xcodeproj
into the file navigator of your app project. - In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
- Ensure that the deployment target of ColiseuPlayer.framework matches that of the application target.
- In the tab bar at the top of that window, open the "Build Phases" panel.
- Expand the "Link Binary with Libraries" group, and add
ColiseuPlayer.framework
. - Click on the
+
button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and addColiseuPlayer.framework
.
Author
Main contributers
License
ColiseuPlayer is released under the MIT license. See LICENSE for details.