Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Options

Igor Oliveira edited this page Jan 10, 2019 · 16 revisions

Options

Parameter Type Default Value Description
kSourceUrl String Sets video source URL
kFullscreen Boolean false Define wether video should start in fullscreen mode. This option doesnt work when kFullscreenByApp is enable
kFullscreenDisabled Boolean false Enable/disable full screen icon on media control
kFullscreenByApp Boolean false If you want to pass the control of fullscreen to the application, a event(Event.requestFullscreen and Event.exitFullscreen) is throw when user request's the control of fullscreen. When this options is true, the player doesnt set the layout to landscape fullscreen
kMediaControl Object Sets external Media Control by passing the type of your class. ex: YourCustomControl.self
kMimeType String Sets mime-type related with the media if you need to use a url without extension.
kPlaybackNotSupportedMessage String Sets message to be displayed if the player can not play a sourceURL
kPosterUrl String Sets poster image URL to video. It will appear before the video starts, disappear on play and go back when video finishes.
kStartAt Double 0.0 Sets starting position for video, in seconds. Ignored for Live Videos.
kMinDvrSize Double 60 Sets the minimum dvr size in seconds in order to enable dvr support
kDefaultSubtitle String Sets default subtitle language.
kDefaultAudioSource String Sets default audio language.
kMediaControlPluginsOrder [String] Set the order of media control plugins in the same panel. Make sure to use the plugin name specified. Example: ["pluginA", "pluginB"]

How to use

To add plugins parameters use the options parameter on constructor:

let options = [key : value]
let player = Player(options: options)

Example:

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

Configure

(This feature is temporarily available only in this branch: https://github.com/clappr/clappr-ios/tree/feat/configure)

You can also change options when the player is already initiated. To do so you must use the method configure. Here's an example:

player.configure(options: [
    kSourceUrl: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
    kPosterUrl: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c0/Big_Buck_Bunny_4K.webm/310px-seek%3D116-Big_Buck_Bunny_4K.webm.jpg",
    kMediaControl: true
])

Fullscreen controled by app

Below there is a example of how to catch events when user requests fullscreen

player.on(Event.requestFullscreen) { _ in 
    // You must inform the player when the application changes the screen state
    player.setFullscreen(true)
}
player.on(Event.exitFullscreen) { _ in 
    // You must inform the player when the application changes the screen state
    player.setFullscreen(false)
}

You need to use player.setFullscreen(true) wether you set the player to fullscreen layout and player.setFullscreen(false) when player is on embed state.

Clone this wiki locally