Giter Club home page Giter Club logo

clappr-ios's Introduction

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

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.