Getting Started
Configuration of the lura player is very straight forward and on point. After following the steps shown in Embedding the Lura Player, you can start exploring the configuration options.
You can simply put the attributes in the following manner to your config.
{ attribute: value, attribute: value, attribute: value, ... }
Simple Configuration for content playback
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.
Play video with the token flow.
This is the most simple and the recommended way of playing videos. Lura Player will configure itself based on the token you configured from MCP.
Attribute | Type | Description |
---|---|---|
token | string | Token of the video from MCP |
LuraPlayer("player", {
token:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2aWQiOiI0MzY2NjIzIiwiaXNzIjoiM1FMWjdaV0JsRko1Vk16Y2pyczJPbTd3VTdEanIzNFkifQ.CruM1W3gIEyQTBTqfaY5gTdf7b_2SSNg4gj6JGOj4Mg",
});
Play video with the url flow.
Attribute | Type | Required | Description |
---|---|---|---|
url | string | Yes | Play URL of the video |
format | "hls", "dash" or "mp4" | No | Play format of the video. Sometimes, the play URL does not contain data about whether the video is HLS or DASH. In this case, the format attribute is used. |
LuraPlayer("player", {
url: "https://example.com/master.m3u8",
format: "hls",
});
You can also play videos in a playlist
Attribute | Type | Description |
---|---|---|
playlist | lura.configurations.ConfigData Array | Array of media info objects composed of token, url and additional parameters |
Adding optional attributes
Attribute | Type | Description |
---|---|---|
autoplay | boolean | Autoplay attribute of the player. Default is false (If set to true, muted attribute might be set to true on some platforms where unmuted autoplay is not supported) |
title | string | Title of the content. (not necessary for token flow) |
description | string | Description of the content. (not necessary for token flow) |
poster | string | Poster image of the content. |
muted | boolean | Whether to start muted attribute of the player. Default is false |
volume | number | Volume betwen 0.0 and 1.0 (Default is 1.0) |
preferredDrm | ("widevine" | "fairplay" | "playready")[] | Preferred DRM (only if client supports that DRM) |
fairplayCertificate | string | Certificate string for FairPlay DRM |
licenseUrl | string | DRM license URL |
ui | "auto" | "none" | UI of the Lura Player. If you want to disable the user interface, pass "none", otherwise "auto" will be used as default. |
playbackSpeed | number | Used to change the playback rate of the playing video. (Default is 1.0) |
plugins | PLUGIN_NAME : PLUGIN_CONFIG_OBJ | Lura Player Plugins |
Example code:
LuraPlayer("player", {
token:
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2aWQiOiI0MzY2NjIzIiwiaXNzIjoiM1FMWjdaV0JsRko1Vk16Y2pyczJPbTd3VTdEanIzNFkifQ.CruM1W3gIEyQTBTqfaY5gTdf7b_2SSNg4gj6JGOj4Mg",
poster: "https://picsum.photos/640/360",
autoplay: true,
muted: true,
plugins: {
ima: {
adTagUrl:
"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=[correlator]",
},
},
});