NSKomodo / clappr-ios

An extensible media player for iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clappr for iOS and tvOS

image

Clappr is an extensible media player for iOS and tvOS.

Installation

CocoaPods

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

$ gem install cocoapods

To integrate Clappr into your Xcode project using CocoaPods, specify it to a target in your Podfile:

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

target '<Your Target Name>' do
    pod 'Clappr', '~> 0.9.0'
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Clappr into your Xcode project using Carthage, specify it in your Cartfile:

github "clappr/clappr-ios"  ~> 0.9.0

Run carthage update to build the framework and drag the built Clappr.framework into your Xcode project.

Usage

iOS

Create

let options = [kSourceUrl : "http://clappr.io/highline.mp4"]
let player = Player(options: options)

Add it in your view

player.attachTo(yourView, controller: self)

tvOS

Create

let options = [kSourceUrl : "https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8"]
let player = Player(options: options)

Add to your controller

addChildViewController(player)
player.view.frame = view.bounds
view.addSubview(player.view)
player.didMove(toParentViewController: self)

The default configuration assumes fullscreen in tvOS, ensure that the corresponding attached view fills all the window area.

Player also supports embedded mode. For this you'll have to disable MediaControl through options:

kMediaControl: false

You can read more about options here.

Events

The player throw's a list of events that can be useful to your application.

Options

You can add options to the player. Here you can see the list of available options and how to use it.

External Playback in Background

To enable external playback while your app is in background, you should include the audio value to your app's Background Modes capabilities.

Manually editing Info.plist

Add the key UIBackgroundModes. Just after adding it to your Info.plist file, Xcode will translate to a more readable value Required background modes, which represents an array of values. Then, add a new item with value audio, which will be translated to App plays audio or streams audio/video using Airplay.

Capabilities Tab

Click on the target that represents your app. Open the Capabilities tab, and there, you'll see the list of available capabilities. One of them is the Background Modes. Change its toggle to on and mark the Audio, Airplay, and Picture in Picture checkbox.

License

You can find it here.

Sponsor

image

About

An extensible media player for iOS.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Swift 67.8%Language:Objective-C 29.0%Language:Ruby 3.1%Language:Makefile 0.1%