Enable DRM with JW Stream

Learn a simplified approach to protecting your iOS content with DRM.


JW Player provides a simplified approach to protecting your content with industry-standard Digital Rights Management (DRM). By enabling DRM on a property from your JW Player dashboard, the complex aspects of DRM management are managed by JW Player on your behalf:

  • Several configured DRM Policies
  • DRM media content key generation and management for FairPlay Streaming
  • License delivery services for content playback on any Apple device

With JW Player managing the technical aspects of DRM, you can focus on the design and implementation of engaging content experiences.

📘

You can also play DRM-protected content if you have not enabled DRM with JW Stream.

JW Player has recommended partners to provide encryption and license serving services:



Requirements



Implementation

  1. Create a signed content URL. Follow steps 1-4 in the Enable DRM with JW Stream Tutorial section.

    The signed content URL returns a JSON object of the content metadata similar to the following example.
{
   "title":"Tears of Steel FPS Test",
   "description":"",
   "kind":"Single Item",
   "playlist":[
      {
         "title":"Tears of Steel FPS Test",
         "mediaid":"WlvsLi24",
         ...
         "images":[...],
         "duration":30,
         "pubdate":1603891888,
         "description":"",
         "sources":[
            {
               "drm":{
                  "fairplay":{
                     "certificateUrl":"CERTIFICATE-URL",
                     "spcProcessUrl":"SPC-PROCESS-URL"
                  },
               },
               "file":"SIGNED-VIDEO-URL",
               "type":"application/vnd.apple.mpegurl"
            },
            ...         
         ],
         "tracks":[...],
         ...
   ],
   "feed_instance_id":"FEED-INSTANCE-ID"
}
  1. From the signed content URL response, extract the file URL (playlist[].sources[].file), the certificate URL (playlist[].sources[].drm.fairplay.certificateUrl) and the SPC Process URL (playlist[].sources[].drm.fairplay.spcProcessUrl).

🚧

The ordering of items within playlist[].sources[] is not static. Therefore, do not use a defined index (playlist[].sources[0]) as part of your extraction process.


  1. Use the extracted file to set up the player.
let url = URL(string: “protected-stream-url.m3u8")!
let playerItem = try! JWPlayerItemBuilder().file(url).build()
let config = try! JWPlayerConfigurationBuilder().playlist([playerItem]).build()
 
player.contentKeyDataSource = self
player.configurePlayer(with: config)
NSError *error;
JWPlayerItemBuilder *builder = [[JWPlayerItemBuilder alloc] init];
[builder file:[NSURL URLWithString:@"protected-stream-url.m3u8"]];
JWPlayerItem *item = [builder buildAndReturnError:&error];
JWPlayerConfigurationBuilder *builder = [[JWPlayerConfigurationBuilder alloc] init];
JWPlayerConfiguration *config = [builder buildAndReturnError:&error];
 
player.contentKeyDataSource = self;
[player configurePlayerWith:config];
  1. Follow the implementation details in Play DRM-protected content in order to play your protected content.


Did this page help you?