FRadioPlayer
FRadioPlayer is a wrapper around AVPlayer to handle internet radio playback.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Features
- [x] Support internet radio URL playback
- [x] Update and parse track metadata
- [x] Update and show album artwork (via iTunes API)
- [x] Automatic handling of interruptions
- [x] Automatic handling of route changes
- [x] Support bluetooth playback
- [x] Swift 4.2
- [x] Full documentation
- [x] Network interruptions handling
- [x] Support for Carthage
- [x] Support for macOS
- [ ] Support for Audio Taps
- [ ] Support for Audio Recording
Requirements
- macOS 10.12 +
- iOS 10 +
- Xcode 10
- Swift 4.2
Installation
CocoaPods
FRadioPlayer is available through CocoaPods. To install
it, simply add the following line to your Podfile:
Carthage
FRadioPlayer is available through Carthage. To install it, simply add the following line to your Cartfile:
Manual
Drag the Source
folder into your project.
Usage
Basics
- Import
FRadioPlayer
(if you are using Cocoapods)
- Get the singleton
FRadioPlayer
instance
- Set the delegate for the player
- Set the radio URL
Properties
-
isAutoPlay: Bool
The player starts playing when theradioURL
property gets set. (default ==true
) -
enableArtwork: Bool
Enable fetching albums artwork from the iTunes API. (default ==true
) -
artworkSize: Int
Artwork image size. (default ==100
| 100x100). -
rate: Float?
Read only property to get the currentAVPlayer
rate. -
isPlaying: Bool
Read only property to check if the player is playing. -
state: FRadioPlayerState
Player current state of typeFRadioPlayerState
. -
playbackState: FRadioPlaybackState
Playing state of typeFRadioPlaybackState
.
Playback controls
- Play
- Pause
- Stop
- Toggle playing state
Delegate methods
Called when player changes state
Called when the playback changes state
Called when player changes the current player item
Called when player item changes the timed metadata value
Called when player item changes the timed metadata value
Called when the player gets the artwork for the playing song
Swift Radio App
For more complete app features, check out Swift Radio App based on FRadioPlayer
Hacking
The Xcode project is generated automatically from project.yml
using XcodeGen. It's only checked in because Carthage needs it, do not edit it manually.