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.

FairPlay

For FairPlay, the license URL and FairPlay certificate data properties must be specified. You can provide the FairPlay certificate data in two ways:

AttributeTypeDescription
datastringFairPlay certificate data.
urlstringURL to download the FairPlay certificate data by GET request.
Swift
// Create media
let media = LuraMedia(url: "ENCRYPTED_MEDIA_URL",
type: "application/x-mpegURL",
licenseUrl: "LICENSE_URL")
// Create content
let luraContent = LuraContent(media: [media],
clientCertificates: nil,
title: "MEDIA_TITLE")
luraContent.clientCertificates.fairplay.data = "YOUR_FAIRPLAY_CERTIFICATE_DATA"

// Create config
let luraConfig = LuraPlayerConfiguration(name: "CONFIGURATION_NAME",
controls: nil,
content: luraContent)