diegomarcon / clappr-ios

An extensible media player for iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Clappr for iOS

image

Installation

The easiest way is through CocoaPods. Simply add the dependency to your Podfile and then pod install:

pod 'Clappr', '~> 0.3'

Using the Player

Create
let options = [kSourceUrl : "http://clappr.io/highline.mp4"]
let player = Player(options: options)
Add it in your view
player.attachTo(yourView, controller: self)
Listen to Events
player.on(PlayerEvent.Play) { userInfo in
    print("on Play")
}

You can find public events on PlayerEvents enum and listed bellow:

  • Ready
  • Play
  • Pause
  • Stop
  • EnterFullscreen
  • ExitFullscreen
  • Error: userInfo can contain the error that caused the event.

Built-in Plugins

To add plugins parameters use the options parameter on constructor. Example:

let options = [kSourceUrl : "http://clappr.io/highline.mp4", pluginParameter1: "value1", pluginParameter2: true]
let player = Player(options: options)
Source

Set the video source url with kSourceUrl : "http://clappr.io/highline.mp4".

Poster

Define a poster by adding kPosterUrl: "http://url/img.png" on your options. It will appear before the video starts, disappear on play and go back when video finishes.

Playback not supported custom message

Add kPlaybackNotSupportedMessage : 'Your custom message' to define a custom message to be displayed for not supported videos.

AutoPlay

Add kAutoPlay: true if you want the video to play automatically.

Start At

Define a start position in seconds with kStartAt : x. Default is 0.

Fullscreen

Define if video should start in fullscreen mode with kFullscreen: true. Default is false.

MimeType

Add kMimeType: 'selected mimetype' if you need to use a url without extension.

Media Control

Adding a custom media control is possible by informing the Type of your class via kMediaControl : YourCustomControl.self

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 49.5%Language:Objective-C 49.1%Language:Ruby 1.4%