All Projects → noreasonprojects → Modernavplayer

noreasonprojects / Modernavplayer

Licence: mit
ModernAVPlayer is a persistence AVPlayer wrapper

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Modernavplayer

Swiftaudio
Audio player for iOS
Stars: ✭ 160 (-10.61%)
Mutual labels:  audio, avplayer, cocoapods
Fwplayer
A video player SDK for iOS, it is based on AVPlayer. https://se.linkedin.com/in/foks-huiwang, https://fokswang.wixsite.com/home
Stars: ✭ 321 (+79.33%)
Mutual labels:  audio, avplayer, cocoapods
Fradioplayer
A simple radio player framework for iOS, macOS, tvOS.
Stars: ✭ 183 (+2.23%)
Mutual labels:  audio, avplayer, cocoapods
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (+455.87%)
Mutual labels:  audio, cocoapods, spm
Sparse
Sparse is a simple parser-combinator library written in Swift.
Stars: ✭ 104 (-41.9%)
Mutual labels:  cocoapods, spm
Fcuuid
iOS UUID / Universally Unique Identifiers library as alternative to UDID and identifierForVendor. 📱
Stars: ✭ 1,387 (+674.86%)
Mutual labels:  persistence, pod
Swiftuiblurview
This view is also part of SwiftUIKit: https://github.com/danielsaidi/SwiftUIKit
Stars: ✭ 120 (-32.96%)
Mutual labels:  cocoapods, spm
Sbplayer ios
基于AVPlayer封装的轻量级播放器,可播放本地及网络视频,易于定制
Stars: ✭ 134 (-25.14%)
Mutual labels:  audio, avplayer
Abmediaview
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.
Stars: ✭ 79 (-55.87%)
Mutual labels:  audio, avplayer
Persistentstreamplayer
Stream audio over http, and persist the data to a local file while buffering
Stars: ✭ 120 (-32.96%)
Mutual labels:  persistence, audio
Abexpandableview
Expandable, collapsible, filterable and single/multi selectable table view.
Stars: ✭ 138 (-22.91%)
Mutual labels:  cocoapods, pod
Nim ios uikit
网易云信 iOS UI 组件,提供聊天界面,文本消息,图片消息,语音消息,视频消息,地理位置消息,自定义消息(阅后即焚)等消息示例。#推荐客户得比特币,首次推荐得0.02BTC,连续推荐得0.03BTC/单,上不封顶。点击参与https://yunxin.163.com/promotion/recommend
Stars: ✭ 1,326 (+640.78%)
Mutual labels:  cocoapods, pod
Rsformview
A Cocoapods library designed to easily create forms with multiple data entry fields
Stars: ✭ 84 (-53.07%)
Mutual labels:  cocoapods, pod
Swifty360player
iOS 360-degree video player streaming from an AVPlayer.
Stars: ✭ 118 (-34.08%)
Mutual labels:  avplayer, cocoapods
Sstoastmessage
SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.
Stars: ✭ 82 (-54.19%)
Mutual labels:  cocoapods, spm
Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-30.17%)
Mutual labels:  cocoapods, pod
Buymeacoffee
Buy Me a Coffee framework for iOS
Stars: ✭ 145 (-18.99%)
Mutual labels:  cocoapods, spm
Bekcurvetabbar
Full Customizable Tabbar with IBInspectables
Stars: ✭ 144 (-19.55%)
Mutual labels:  cocoapods, pod
Color
Color utilities for macOS, iOS, tvOS, and watchOS
Stars: ✭ 145 (-18.99%)
Mutual labels:  cocoapods, spm
Sheeeeeeeeet
Sheeeeeeeeet is a Swift library for creating menus, custom action sheets, context menus etc.
Stars: ✭ 1,177 (+557.54%)
Mutual labels:  cocoapods, spm

ModernAVPlayer

Swift 4.2 Build Status CocoaPods CocoaPods

ModernAVPlayer is a persistence AVPlayer wrapper

++ Cool features ++

  • Get 9 nice and relevant player states (playing, buffering, loading, loaded...)
  • Persistence player to resume playback after bad network connection even in background mode (bug from version 1.5.1)
  • Manage headphone interactions, call & siri interruptions, now playing informations
  • Add your own plug-in to manage tracking, events...
  • RxSwift compatible
  • Loop mode
  • Log available by domain

Known issue

From version 1.5.1, resume playback from background mode failed. If you have any suggestion, please help.

Use of mixWithOther AVAudiosession CategoryOptions is not a solution.


Menu

Requirements

  • iOS 10.0+
  • tvOS 10.0+

In order to support background mode, append the following to your Info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
</array>

Installation

Swift Package Manager

Supported version: swift-tools-version:5.0

// Package.swift

import PackageDescription

let package = Package(
    name: "Sample",
    dependencies: [
        .package(url: "https://github.com/noreasonprojects/ModernAVPlayer", from: "X.X.X")
    ],
    targets: [
        .target(name: "Sample", dependencies: ["ModernAVPlayer"])
    ]
)

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, '10.0'
use_frameworks!

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

Then, run the following command:

$ pod install

Getting started

Create media from URL

let media = ModernAVPlayerMedia(url: URL, type: MediaType)

Create media from AVPlayerItem

let media = ModernAVPlayerMediaItem(item: AVPlayerItem, type: MediaType, metadata: PlayerMediaMetadata)

Instanciate the wrapper

let player = ModernAVPlayer()

Load and play the media

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

Track on repeat

player.loopMode = true
↓ 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 O X X X

Advanced

Custom configuration

All player configuration are available from PlayerConfiguration protocol.
A default implementation ModernAVPlayerConfiguration is provided with documentation


Remote command

If using default configuration file ( swift useDefaultRemoteCommand = true), ModernAVPlayer use automatically all commands created by ModernAVPlayerRemoteCommandFactory class Documention available in ModernAVPlayerRemoteCommandFactory.swift file

Custom command

Use your own PlayerConfiguration implementation with

...
useDefaultRemoteCommand = false
...

Create an array of commands conforming to ModernAVPlayerRemoteCommand protocol.

let player = ModernAVPlayer(config: YourConfigImplementation())
let commands: [ModernAVPlayerRemoteCommand] = YourRemoteCommandFactory.commands
player.remoteCommands = commands

You can use existing commands from public ModernAVPlayerRemoteCommandFactory class.


Plugin

Use PlayerPlugin protocol to create your own plugin system, like tracking Plugin.


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, make a pull request using Simple Audio template in the example section to demonstrate.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].