Configuring Media Sources
Configuring the media sources for video playback is a crucial first step in ensuring a seamless viewing experience. You should provide the appropriate sources based on device capabilities. Choosing the wrong source can lead to playback failure. Therefore, it's essential to configure the stream sources correctly to ensure smooth playback and prevent frustration for the viewer. By taking the time to properly configure the stream sources, the viewer can fully immerse themselves in the content without any distractions or interruptions.
To configure the media sources of the video in Lura Player, you can use the following configuration.
Attribute | Type | Required | Description |
---|---|---|---|
url | String | yes | Content URL |
type | String | yes | MIME type of the content |
licenseUrl | String | no | License URL of the content. (Only required for DRM Protected videos) |
width | Int | No | Media width |
height | Int | No | Media height |
Fairplay DRM configuration needs an additional step. You need to provide the certificate data or a URL to download the certificate data by a GET request. For more information, please follow DRM Configuration
Here are the supported MIME types:
- application/dash+xml - For DASH streams
- application/x-mpegURL - For HLS streams
- video/mp4 - For MP4 videos
val luraConfiguration = LuraConfiguration(
...
content = LuraContent(
media = listOf(
LuraMedia(
type = "video/x-mpegurl",
url = "https://media.example.com/hls.m3u8",
licenseUrl = "https://license.example.com"
)
),
...
),
...
)
playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)
You can also add multiple media sources, Lura Player will adaptively select the media source based on the platforms capabilities.
val luraConfiguration = LuraConfiguration(
...
content = LuraContent(
media = listOf(
LuraMedia(
type = "video/x-mpegurl",
url = "https://media.example.com/hls.m3u8",
licenseUrl = "https://license.example.com"
),
LuraMedia(
type = "video/dash+xml",
url = "https://media.example.com/dash.mpd",
licenseUrl = "https://license.example.com"
),
LuraMedia(
type = "video/mp4",
url = "https://media.example.com/mp4.mp4",
licenseUrl = "https://license.example.com"
),
...
),
...
),
...
)
playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)