Latest 0.9.6
Homepage https://github.com/raphrel/ModernAVPlayer
License MIT
Platforms ios 9.0
Authors

Build Status
CocoaPods
CocoaPods

ModernAVPlayer is an audio persistence AVPlayer wrapper

Requirements

  • iOS 9.0+
  • Xcode 9.3+
  • Swift 4.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.3+ is required to build ModernAVPlayer.

To integrate ModernAVPlayer into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'ModernAVPlayer'
end

Then, run the following command:

$ pod install

Prerequisites

  • In order to support background mode, append the following to your Info.plist:
<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
</array>

Getting started

  • Play your first audio source:

Create a media

let media = ModernAVPlayerMedia(url: liveUrl, type: .stream, isLive: true)

Instanciate the wrapper

let player = ModernAVPlayer()

Load and play the media

player.loadMedia(media: media, autostart: true)

Available Commands

↓ State / Command → loadMedia play pause stop seek
Init O X O O X
Loading O X O O X
Loaded O O O O O
Buffering O X O O O
Playing O X O O O
Paused O O X O O
Stopped O O O X O
WaitingNetwork O X O O X
Failed O X X X X

Plugin

Use PlayerPlugin protocol to create your own plugin system.

Configuration

All player configuration are available from ContextConfiguration protocol.
A default implementation ModernAVPlayerConfig is provided with documentation

RxSwift

Instead of using delegate pattern, you can use rx to bind player attributes.

Setup
Use pod 'ModernAVPlayer/RxSwift' in the Podfile
Usage

let player = ModernAVPlayer()
let state: Observable<ModernAVPlayer.State> = player.rx.state

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Latest podspec

{
    "name": "ModernAVPlayer",
    "version": "0.9.6",
    "summary": "ModernAVPlayer is an audio persistence AVPlayer wrapper",
    "description": "ModernAVPlayer is an ongoing project that aims to create a more usable audio video player with readable status and network persistence option.",
    "homepage": "https://github.com/raphrel/ModernAVPlayer",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "raphael ankierman": "[email protected]"
    },
    "source": {
        "git": "https://github.com/raphrel/ModernAVPlayer.git",
        "tag": "0.9.6"
    },
    "default_subspecs": "Core",
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.0",
    "subspecs": [
        {
            "name": "Core",
            "source_files": "Sources/Core/**/*"
        },
        {
            "name": "RxSwift",
            "dependencies": {
                "ModernAVPlayer/Core": [],
                "RxSwift": [
                    "~> 4.0"
                ],
                "RxCocoa": [
                    "~> 4.0"
                ]
            },
            "source_files": "Sources/RxModernAVPlayer/**/*"
        }
    ]
}

Pin It on Pinterest

Share This