Skip to main content

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.

AttributeTypeRequiredDescription
urlstringyesContent URL
typestringyesMIME type of the content
licenseUrlstringnoLicense URL of the content. (Only required for DRM Protected videos)
note

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
Single media example
m.player.callFunc("setConfig", {
...
content: {
media: [
...
{
url: "https://media.example.com/hls.m3u8",
type: "application/x-mpegURL",
licenseUrl: "https://license.example.com"
}
...
]
}
...
})

You can also add multiple media sources, Lura Player will adaptively select the media source based on the platforms capabilities.

Multiple media example
m.player.callFunc("setConfig", {
...
content: {
media: [
...
{
url: "https://media.example.com/hls.m3u8",
type: "application/x-mpegURL",
licenseUrl: "https://license.example.com"
},
{
url: "https://media.example.com/dash.mpd",
type: "application/dash+xml",
licenseUrl: "https://license.example.com"
},
{
url: "https://media.example.com/mp4.mp4",
type: "video/mp4",
licenseUrl: "https://license.example.com"
},
...
]
}
...
})