Getting Started
Configuration of the Lura Player is very straight forward and on point. After following the steps shown in Importing the Lura Player, you can start exploring the configuration options.
To start simple, we will start with the basic attributes to play a video. There are two ways to play a video in Lura Player.
Lura configuration for content playback
This is the most simple way of playing videos. Lura Player will configure itself based on the play configuration you have configured from MCP. To see more details, check out Lura Configuration
Attribute | Type | Description |
---|---|---|
appKey | string | AppKey generated in MCP based on the pre-adjusted play configuration |
assetId | string | AssetId of the VOD or the Live Stream |
Swift
let player = try? LuraPlayer(playerView: playerView)
player?.addListener(listener: luraListener)
let lura = Lura(appKey: "APP_KEY", assetId: "ASSET_ID")
let luraConfig = LuraPlayerConfiguration(lura: lura)
player?.setConfig(luraConfig)
Manual media configuration for content playback
To manually configure the media, you need to add following media objects and attributes based on your needs.
- Media source
- DRM configuration
- Caption source
- Poster image source
- Trick play image source
- Title configuration
- Description configuration
- Start at configuration
- Annotations configuration
Here is an example code to play a media with all features.
Single media example
let player = try? LuraPlayer(playerView: playerView)
player?.addListener(listener: luraListener)
let media = LuraMedia(url: url,
type: "application/x-mpegURL",
licenseUrl: nil)
// Create certificate
var drm = LuraPlayerConfiguration.Content.ClientCertificate()
if let cert = license.certificate {
drm.fairplay.data = cert
}
let luraContent = LuraContent(media: [media],
title: "Media Title",
clientCertificates: drm)
// Create config
let luraConfig = LuraPlayerConfiguration(name: "Configuration Name",
controls: nil,
content: luraContent)
player?.setConfig(luraConfig)