Code Monkey home page Code Monkey logo

fradioplayer's Introduction

FRadioPlayer

CI Status Version License Platform

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

  • Support internet radio URL playback
  • Update and parse track metadata
  • Update and show album artwork (via iTunes API)
  • Automatic handling of interruptions
  • Automatic handling of route changes
  • Support bluetooth playback
  • Swift 4
  • Full documentation
  • Handling network errors
  • Support for Carthage
  • Support for Audio Taps
  • Support for Audio Recording

Requirements

  • iOS 9 +
  • Xcode 9
  • Swift 4

Installation

CocoaPods

FRadioPlayer is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'FRadioPlayer'

Manual

Drag the Source folder into your project.

Usage

Basics

  1. Import FRadioPlayer (if you are using Cocoapods)
import FRadioPlayer
  1. Get the singleton FRadioPlayer instance
let player = FRadioPlayer.shared
  1. Set the delegate for the player
player.delegate = self
  1. Set the radio URL
player.radioURL = URL(string: "http://example.com/station.mp3")

Properties

  • isAutoPlay: Bool The player starts playing when the radioURL 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 current AVPlayer rate.

Playback controls

  • Play
player.play()
  • Pause
player.pause()
  • Stop
player.stop()

Delegate methods

Called when player changes state

func radioPlayer(_ player: FRadioPlayer, playerStateDidChange state: FRadioPlayerState)

Called when the player changes the playing state

func radioPlayer(_ player: FRadioPlayer, player isPlaying: Bool)

Called when player changes the current player item

func radioPlayer(_ player: FRadioPlayer, itemDidChange url: URL?)

Called when player item changes the timed metadata value

func radioPlayer(_ player: FRadioPlayer, metadataDidChange artistName: String?, trackName: String?)

Called when player item changes the timed metadata value

func radioPlayer(_ player: FRadioPlayer, metadataDidChange rawValue: String?)

Called when the player gets the artwork for the playing song

func radioPlayer(_ player: FRadioPlayer, artworkDidChange artURL: URL?)

Author

Fethi El Hassasna

License

FRadioPlayer is available under the MIT license. See the LICENSE file for more info.

fradioplayer's People

Contributors

fethica avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.