Skip to main content

Adding DRM Information

The example code shows how to use the LuraPlayer to play encrypted content protected with Digital Rights Management (DRM) systems. LuraPlayer currently supports fairplay, widevine, and playready.

A DRM (Digital Rights Management) license URL is a URL that points to a server that issues licenses for protected digital content. When content is protected by DRM, it is encrypted to prevent unauthorized access and distribution. In order to view or use the content, the user needs a license that grants them permission to do so. The license contains information such as the user's rights to the content, the expiration date of the license, and the decryption key needed to access the content.

Widevine and Playready

To configure Widevine or Playready DRM in Lura Player, you only need to add a license URL to the encrypted media object.

AttributeTypeRequiredDescription
licenseUrlStringyesLicense URL of the content.
val luraConfiguration = LuraConfiguration(
content = LuraContent(
media = listOf(
LuraMedia(
type = "video/x-mpegurl",
url = "YOUR_PROTECTED_MEDIA",
licenseUrl = "YOUR_DRM_LICENSE_SERVER_URL"
)
),
id = "id",
title = "title",
type = LuraVideoType.VOD
),
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)

Preferred DRM Systems

You can specify the Preferred DRM Systems on your configuration by adding preferredDRMSystems attribute to your configuration. By specifying this attribute, LuraPlayer will only try to use the preferred DRM systems on supported devices.

danger

Specifying this attribute may lead to playback failure if none of the preferred drm systems are supported on the browser. Please provide the widest range of DRM systems the license server supports.

AttributeTypeDescription
preferredDRMSystemsList<String>Preferred DRM Systems.
Preferred DRM Systems
val luraConfiguration = LuraConfiguration(
content = LuraContent(
media = listOf(
LuraMedia(
type = "video/x-mpegurl",
url = "YOUR_PROTECTED_MEDIA",
licenseUrl = "YOUR_DRM_LICENSE_SERVER_URL"
)
),
preferredDRMSystems = arrayListOf("widevine"),
id = "id",
title = "title",
type = LuraVideoType.VOD
),
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)