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.

MediaItem Attributes.

AttributeTypeRequiredDescription
url StringYesContent URL.
typeString?NoMIME type of the content.
licenseUrlString?NoLicense 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/x-mpegURL - For HLS streams
  • video/mp4 - For MP4 videos

Example Code

Single media example
// 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)
Multiple media example
// 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)