[object Object] Icon

Learn how to create, start, manage and modify Encodings

[object Object] Icon

Learn how to create, start, manage and modify Players

[object Object] Icon

Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Thu Aug 30 2018

How to create Fairplay DRM protected content

OverviewLink Icon

Fairplay is the Apple DRM and was initially used only in the iTunes store to protect AAC encoded audio files but got soon also adopted for Apple’s video products that are now part of the iTunes store. Fairplay is specifically designed for Apple HTTP Live Streaming (HLS) with Apple playback devices such as iPhone, iPad, Apple TV and Mac OS X. Fairplay is also used as Content Decryption Module (CDM) of the Safari browser. This enables HTML5 native playback of DRM encrypted Fairplay streams without plugins in Safari.

Encoding configurationLink Icon

This tutorial is based on this full example, which is using our Bitmovin PHP API client, however we do offer API clients in other languages as well. If you haven't created any encodings with our API clients yet, we recommend you to read the getting started guide called "Create an Encoding with our API" at first, before you continue.

Lets start with the preparation of required information we need in order to protect your content using Fairplay DRM. This values will be provided by your multi DRM licensing server provider such as Irdeto, EZDRM, ExpressPlay, Axinom, etc.

Hint: Please be informed that you need a Fairplay certificate from Apple in order to be able to use Fairplay DRM. Therefore you have to request a FPS Deployment package. More details about Fairplay are available at https://developer.apple.com/streaming/fps/.

1$fairPlayKey = "0123456789abcdef0123456789abcdef";
2$fairPlayIV = "0123456789abcdef0123456789abcdef";
3$fairPlayUri = "skd://userspecifc?custom=information";

The parameters of the Fairplay DRM configuration have the following meaning:

  • fairPlayKey: You need to provide a key that will be used to encrypt the content (16 byte; 32 hexadecimal characters)
  • fairPlayIV: The initialization vector is optional. If it is not provided we will generate one for you. (16 byte; 32 hexadecimal characters)
  • fairPlayUri: If provided, this URI will be used for license acquisition
1$tsMuxing1080p = createTsMuxing($apiClient, $encoding, $videoStream1080p, null, null);
2$audioTsMuxing128 = createTsMuxing($apiClient, $encoding, $audioEncodingStream128, null, null);
4$fairPlayEncodingOutput1080p = createEncodingOutput($output, $outputPath . 'video/1080p/hls/drm/');
5$fairPlayDrm1080p = createFairPlayDrm($fairPlayKey, $fairPlayIV, $fairPlayUri, array($fairPlayEncodingOutput1080p));
6$videoTsDrm1080p = $apiClient->encodings()->muxings($encoding)->tsMuxing()->drm($tsMuxing1080p)->fairplay()->create($fairPlayDrm1080p);
8$audioFairPlayEncodingOutput128 = createEncodingOutput($output, $outputPath . 'audio/128kbps/hls/drm/');
9$audioFairPlayDrm128 = createFairPlayDrm($fairPlayKey, $fairPlayIV, $fairPlayUri, array($audioFairPlayEncodingOutput128));
10$audioTsDrm128 = $apiClient->encodings()->muxings($encoding)->tsMuxing()->drm($audioTsMuxing128)->fairplay()->create($audioFairPlayDrm128);

Hint: If you would provide a output location for the muxing as well, our API would store unencrypted segments to the given output location as well.

Give us feedback