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.
MediaItem Attributes.
Attribute | Type | Required | Description |
---|---|---|---|
url | String | Yes | Content URL. |
type | String? | No | MIME type of the content. |
licenseUrl | String? | No | License URL of the content. (Only required for DRM Protected videos) |
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/x-mpegURL - For HLS streams
- video/mp4 - For MP4 videos
Example Code
// Create media
let media = LuraMedia(url: url,
type: "application/x-mpegURL",
licenseUrl: nil)
// Create content
let luraContent = LuraContent(media: [media],
title: "Media Title")
// Create config
let luraConfig = LuraPlayerConfiguration(name: "Configuration Name",
controls: nil,
content: luraContent)
// Create media
let media1 = LuraMedia(url: url,
type: "application/x-mpegURL",
licenseUrl: nil)
let media2 = LuraMedia(url: url,
type: "video/mp4",
licenseUrl: nil)
// Create content
let luraContent = LuraContent(media: [media1,media2],
title: "Media Title")
// Create config
let luraConfig = LuraPlayerConfiguration(name: "Configuration Name",
controls: nil,
content: luraContent)