• How to set up and test BuyDRM KeyOS DRM (PlayReady)

    Instructions for integrating Wowza™ media server software with BuyDRM KeyOS. A Wowza media server can protect both Apple HLS and Microsoft Smooth Streaming live and video-on-demand streams using Microsoft PlayReady encryption for playback using the BuyDRM desktop and mobile player technology.

    Note: Wowza Streaming Engine™ software or Wowza Media Server™ software (version 3.5 or later) and Wowza DRM are required.

    Setup


    1. Configure an application for either live or video on demand streaming following one of our tutorials. To configure the media server so that RTSP, Flash RTMP, and Flash HTTP streams won't be encrypted, configure the application to deny connections from these players.

    2. Sign up for the BuyDRM KeyOS service at BuyDRM.com. After you sign up, you'll get an email from BuyDRM with your UserKey, which is referred to as [user-key] below. You'll also get the KeyOS Smooth Streaming Deployment KIT that has a sample BuyDRM KeyOS player and instructions for creating a KeyOS authentication.

    Configuration


    Add the BuyDRM module and properties to configure the BuyDRM module to the Application.xml file for the application that you created. Open [install-dir]/conf/[application]/Application.xml in a text editor and make the following changes (where [application] is the live or video on demand application that you set up above):

    1. Add the following <Module> entry as the last entry in the <Modules> list:
      <Module>
          <Name>ModuleDRMBuyDRM</Name>
          <Description>ModuleDRMBuyDRM</Description>
          <Class>com.wowza.wms.drm.module.buydrm.ModuleDRMBuyDRM</Class>
      </Module>
    2. Add the following properties to the <Properties> container at the bottom of the Application.xml file (be sure to get the correct <Properties> container as there are several in the file):
      <Property>
          <Name>drmBuyDRMUserKey</Name>
          <Value>[user-key]</Value>
      </Property>
      <Property>
          <Name>drmBuyDRMStreamNameMapFile</Name>
          <Value>${com.wowza.wms.context.VHostConfigHome}/conf/buydrmstreammap.txt</Value>
      </Property>
      <Property>
          <Name>drmBuyDRMProtectSmoothStreaming</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      <Property>
          <Name>drmBuyDRMProtectCupertinoStreaming</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      <Property>
          <Name>drmBuyDRMProtectMpegDashStreaming</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      <Property>
          <Name>drmBuyDRMIfFailFakeKey</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      <Property>
          <Name>drmBuyDRMDebugLog</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      <Property>
          <Name>drmBuyDRMActionLog</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      <Property>
          <Name>cupertinoEncryptionAPIBased</Name>
          <Value>true</Value>
          <Type>Boolean</Type>
      </Property>
      The [user-key] is your BuyDRM user key that was sent to you when you registered for BuyDRM KeyOS.

    3. Using a text editor, create the file [install-dir]/conf/buydrmstreammap.txt with the following content:
      *={keyId:${KeyIdGenerator.Random},contentId:${KeyId},mediaId:${Stream.Name}}
      This file is used to map stream names to PlayReady key information. The default setup protects all streams using a randomly generated keyId. The contentId is set to keyId and the mediaId is set to the stream name. For a more detailed description of how the map file works, see Map file details (buydrmstreammap.txt).

      Note: If the buydrmstreammap.txt isn't found or is incorrect, the drmBuyDRMIfFailFakeKey property can be used to randomly generate a fake key for encrypting the streams. The default property value (true) causes the content to be encrypted with the fake key. If this property is set to false, the stream will not be encrypted.

    Playback


    BuyDRM will provide you with KeyOS Licensing API documents to enable playback of encrypted content. Contact them at sales@buydrm.com or go to http://buydrm.com/contact.php.

    BuyDRM KeyOS Android and IOS players

    Encrypted HLS, Smooth, and MPEG-DASH streams can be played using the technologies provided in the BuyDRM KeyOS Android and IOS player SDKs.

    1. Get the BuyDRM KeyOS Android or IOS player directly from BuyDRM, or build a player from the respective player SDK.

    2. Create an authorization for the player.

    3. Configure the player's vector file to use the authorization and point to the stream from the Wowza media server.

    For example, if you set up an application named vod and you want to stream the file sample.mp4, the BuyDRM vector file will look something like this:
    <?xml version="1.0" encoding="utf-8" ?>
    <contents version="1.0">
        <content>
            <name>MPEG-DASH Streaming</name>
            <uri>http://localhost:1935/vod/mp4:sample.mp4/manifest.mpd</uri>
            <extra name="playready-lic-acq-url">http://sl.licensekeyserver.com/core/rightsmanager.asmx</extra>
            <extra name="playready-lic-acq-custom">PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxLZXlPU0F1dGhlbnRpY2F0aW9uWE1MPjxEYXRhPjxQb2xpY3k+PE1pbmltdW1TZWN1cml0eUxldmVsPjE1MDwvTWluaW11bVNlY3VyaXR5TGV2ZWw+PC9Qb2xpY3k+PEdlbmVyYXRpb25UaW1lPjIwMTMtMDUtMDcgMjE6MDk6MTEuMDAwPC9HZW5lcmF0aW9uVGltZT48RXhwaXJhdGlvblRpbWU+MjAxNC0wNS0wNyAyMTowOToxMS4wMDA8L0V4cGlyYXRpb25UaW1lPjxVbmlxdWVJZD4zNWFkZTU1ZDMzODE0M2QzODNmNjRmYTFjMmJmZDRlMDwvVW5pcXVlSWQ+PFJTQVB1YktleUlkPjIwZDJjNWYyNGRmNzdjZThlYjBjYjE3NWJiOGI1OTA0PC9SU0FQdWJLZXlJZD48L0RhdGE+PFNpZ25hdHVyZT5PUTVrZDR5MFdiMTAvU1VQdm1ZYnZVK3d5M0dQTCttZ3dpOVlOT3BWUElYTXQ2THU4SkpUQjNid0hlbndtb0RrZjllTHhjNncvT21GeTJNekYraFpKLzd2NUhaVVNEK2lRNDA0ZHVJRXZTbER4ZW0xK0dFejlsT1VJdXh1a3pIVzIrbE05ZEc0TzU1U2FwSXdjNHZIK3cyZ1ZiaWNkcGdackVkQW8yOXNmN0NGbHR1S0lKY2hwMmF0Vm0xaFdvUmZ0eWlBZVZkR0MxVjFuS1JqdlZPNFZuNERFdnR1MmY2MitETC9LSUU1UG9GVnQzV0dJU3E4aUxQcXpaMXhoRHVraDlsTDdxcnRhbkRqR3hJeDNjQWpOQlRicmhYMGk0VnUxYU15YnRhcU05QjdUUS80Z0F0NlE3WUx3UEpQeHphNXZuNlZLNmxMWVRCeWRlSDNDL0hhVVE9PTwvU2lnbmF0dXJlPjwvS2V5T1NBdXRoZW50aWNhdGlvblhNTD4K</extra>
        </content>
        <content>
            <name>Microsoft Smooth Streaming</name>
            <uri>http://localhost:1935/vod/mp4:sample.mp4/Manifest</uri>
            <extra name="playready-lic-acq-url">http://sl.licensekeyserver.com/core/rightsmanager.asmx</extra>
            <extra name="playready-lic-acq-custom">PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxLZXlPU0F1dGhlbnRpY2F0aW9uWE1MPjxEYXRhPjxQb2xpY3k+PE1pbmltdW1TZWN1cml0eUxldmVsPjE1MDwvTWluaW11bVNlY3VyaXR5TGV2ZWw+PC9Qb2xpY3k+PEdlbmVyYXRpb25UaW1lPjIwMTMtMDUtMDcgMjE6MDk6MTEuMDAwPC9HZW5lcmF0aW9uVGltZT48RXhwaXJhdGlvblRpbWU+MjAxNC0wNS0wNyAyMTowOToxMS4wMDA8L0V4cGlyYXRpb25UaW1lPjxVbmlxdWVJZD4zNWFkZTU1ZDMzODE0M2QzODNmNjRmYTFjMmJmZDRlMDwvVW5pcXVlSWQ+PFJTQVB1YktleUlkPjIwZDJjNWYyNGRmNzdjZThlYjBjYjE3NWJiOGI1OTA0PC9SU0FQdWJLZXlJZD48L0RhdGE+PFNpZ25hdHVyZT5PUTVrZDR5MFdiMTAvU1VQdm1ZYnZVK3d5M0dQTCttZ3dpOVlOT3BWUElYTXQ2THU4SkpUQjNid0hlbndtb0RrZjllTHhjNncvT21GeTJNekYraFpKLzd2NUhaVVNEK2lRNDA0ZHVJRXZTbER4ZW0xK0dFejlsT1VJdXh1a3pIVzIrbE05ZEc0TzU1U2FwSXdjNHZIK3cyZ1ZiaWNkcGdackVkQW8yOXNmN0NGbHR1S0lKY2hwMmF0Vm0xaFdvUmZ0eWlBZVZkR0MxVjFuS1JqdlZPNFZuNERFdnR1MmY2MitETC9LSUU1UG9GVnQzV0dJU3E4aUxQcXpaMXhoRHVraDlsTDdxcnRhbkRqR3hJeDNjQWpOQlRicmhYMGk0VnUxYU15YnRhcU05QjdUUS80Z0F0NlE3WUx3UEpQeHphNXZuNlZLNmxMWVRCeWRlSDNDL0hhVVE9PTwvU2lnbmF0dXJlPjwvS2V5T1NBdXRoZW50aWNhdGlvblhNTD4K</extra>
        </content>
        <content>
            <name>Apple HLS Streaming</name>
            <uri>http://localhost:1935/vod/mp4:sample.mp4/playlist.m3u8</uri>
            <extra name="playready-lic-acq-url">http://sl.licensekeyserver.com/core/rightsmanager.asmx</extra>
            <extra name="playready-lic-acq-custom">PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxLZXlPU0F1dGhlbnRpY2F0aW9uWE1MPjxEYXRhPjxQb2xpY3k+PE1pbmltdW1TZWN1cml0eUxldmVsPjE1MDwvTWluaW11bVNlY3VyaXR5TGV2ZWw+PC9Qb2xpY3k+PEdlbmVyYXRpb25UaW1lPjIwMTMtMDUtMDcgMjE6MDk6MTEuMDAwPC9HZW5lcmF0aW9uVGltZT48RXhwaXJhdGlvblRpbWU+MjAxNC0wNS0wNyAyMTowOToxMS4wMDA8L0V4cGlyYXRpb25UaW1lPjxVbmlxdWVJZD4zNWFkZTU1ZDMzODE0M2QzODNmNjRmYTFjMmJmZDRlMDwvVW5pcXVlSWQ+PFJTQVB1YktleUlkPjIwZDJjNWYyNGRmNzdjZThlYjBjYjE3NWJiOGI1OTA0PC9SU0FQdWJLZXlJZD48L0RhdGE+PFNpZ25hdHVyZT5PUTVrZDR5MFdiMTAvU1VQdm1ZYnZVK3d5M0dQTCttZ3dpOVlOT3BWUElYTXQ2THU4SkpUQjNid0hlbndtb0RrZjllTHhjNncvT21GeTJNekYraFpKLzd2NUhaVVNEK2lRNDA0ZHVJRXZTbER4ZW0xK0dFejlsT1VJdXh1a3pIVzIrbE05ZEc0TzU1U2FwSXdjNHZIK3cyZ1ZiaWNkcGdackVkQW8yOXNmN0NGbHR1S0lKY2hwMmF0Vm0xaFdvUmZ0eWlBZVZkR0MxVjFuS1JqdlZPNFZuNERFdnR1MmY2MitETC9LSUU1UG9GVnQzV0dJU3E4aUxQcXpaMXhoRHVraDlsTDdxcnRhbkRqR3hJeDNjQWpOQlRicmhYMGk0VnUxYU15YnRhcU05QjdUUS80Z0F0NlE3WUx3UEpQeHphNXZuNlZLNmxMWVRCeWRlSDNDL0hhVVE9PTwvU2lnbmF0dXJlPjwvS2V5T1NBdXRoZW50aWNhdGlvblhNTD4K</extra>
        </content>
    </contents>
    If not testing on the same computer running the Wowza media server software, change localhost to your Wowza media server IP address or hostname.

    BuyDRM Smooth Streaming player

    Encrypted Smooth streams can be played using the BuyDRM Smooth Streaming (browser) based media player from BuyDRM.

    1. Get the BuyDRM Smooth Streaming based media player from BuyDRM.

    2. Create an authorization for the player.

    3. Configure the player to use the authorization and point to the Smooth Stream stream from the Wowza media server.

    For example, if you set up an application named vod and you want to stream the file sample.mp4, the BuyDRM <PlayList> HTML code will look something like this:
    <PlayList>
    <Item>
      <IsDRM>true</IsDRM>
      <AuthXML>PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxLZXlPU0F1dGhlbnRpY2F0aW9uWE1MPjxEYXRhPjxHZW5lcmF0aW9uVGltZT4yMDExLTA0LTE4IDE4OjU3OjEzLjAwMDwvR2VuZXJhdGlvblRpbWU+PEV4cGlyYXRpb25UaW1lPjIwMTItMDQtMTggMTg6NTc6MTMuMDAwPC9FeHBpcmF0aW9uVGltZT48VW5pcXVlSWQ+MDEyOTg1YWFkNThhNDkzMTg3ZWQ0ZjJlOTE0ZmVmNTg8L1VuaXF1ZUlkPjxSU0FQdWJLZXlJZD45Y2FlYTY1YmVmY2YzNGEyNGY5ZWIxNTgyYTE1ODhhMTwvUlNBUHViS2V5SWQ+PC9EYXRhPjxTaWduYXR1cmU+QUJudGs1TkpWMnBTY0FWeDhBOWNMd3lkNmRvaXVGeWtJMWM0N0VKekR6cTVlVktuUkc3TGh6QTltRG92aGE1bVN3bC9MMnMveXJUVm11RU1hdytoQmZKdklNOUFDOHhPSWk2TE5OalJJOEhKYkdEY3lKTXZZUzRBN0ZRSkVkMHk5U3pvS08wSERNWWlSb1dSMEhzbTloWGNaS3RHeGNRMnhUbzMzRldGMmpsSzFwR1FsakVjV2hTYUpaQ1dIbWN4UXdnSElLNWtZYjFwWXE5V3lWQXFGNEFmR0dZWThMRlR4QW1rRngweHN2a1FUb3JiVklFTDFMbTZxUWY5RVNpd2xvZm56RjZhR0ZMUGJyLzZrdWZ1dUFrdGJOeFllVE5QZXZ6TmpUZGQvc29zQnM4WHhqM2tYTktyalgwOWx1VERrRmdOU0NRZ3UyVy81UkNuUkJHb1J3PT08L1NpZ25hdHVyZT48L0tleU9TQXV0aGVudGljYXRpb25YTUw+Cg==</AuthXML>
      <MediaSource>http://localhost:1935/vod/mp4:sample.mp4/Manifest</MediaSource>
      <Title>Demo</Title>
      <DeliveryMethod>adaptivestreaming</DeliveryMethod>
    </Item>
    </PlayList>
    If not testing on the same computer running the Wowza media server software, change localhost to your Wowza media server IP address or hostname.

    Map file details (buydrmstreammap.txt)


    The buydrmstreammap.txt file is used to map stream names to BuyDRM keyIds, contentIds, mediaIds, and adaptiveGroups. The part of the entry to the left of the equal sign(=) is the stream name match and the right side is a structure that defines the BuyDRM keyIds, contentIds, mediaIds, and adaptiveGroup values. When matching a stream name to a map entry, the first entry that matches the stream name is used. If there's no match for a stream name, then the stream isn't protected using PlayReady. Stream map entries can include wildcard characters (*) or simple stream names.

    The BuyDRM map entry is used to define the following values:

    • keyId: The PlayReady keyId.
    • contentId: The BuyDRM contentId. The default value for this item is variable ${KeyId}
    • mediaId: The BuyDRM mediaId. The default value for this item is variable ${Stream.Name}
    • adaptiveGroup (optional):The adaptive group to which this entry is part of (if any). All streams within the same adaptiveGroup will be encrypted with the same key. This item can be set to any normal string value, avoiding any special characters.

    The values for keyId, contentId, and mediaId can be set to either a hardcoded value or to a variable. The following variables are supported:

    keyId variables
    • ${KeyIdGenerator.Random}: The keyId variable is randomly generated each time it's referenced.

    contentId variables
    • ${KeyId}: The contentId is set to the same values as the keyID. This is the default value for contentId.

    mediaId variables
    • ${KeyId}: The keyId
    • ${VHost.Name}: The virtual host name
    • ${Application.Name}: The application name
    • ${AppInstance.Name}: The application instance name
    • ${Stream.Name}: The stream name

    Following is an example of a buydrmstreammap.txt file:
    sample.mp4={keyId:F6005DCF-7F93-4B8E-85C7-F908840DA059,contentId:F6005DCF-7F93-4B8E-85C7-F908840DA059,mediaId:${Application.Name}/${AppInstance.Name}/${Stream.Name}}
    mymusic.mp4={keyId:E45F3254-846D-BBE4-4FD6-E467B78A0910,contentId:E45F3254-846D-BBE4-4FD6-E467B78A0910,mediaId:mymusic}
    music*={keyId:${KeyIdGenerator.Random},contentId:${KeyId},mediaId:music-${Stream.Name}}
    video*={keyId:${KeyIdGenerator.Random},contentId:${KeyId},mediaId:video-${Stream.Name}}
    myStream*={keyId:${KeyIdGenerator.Random},contentId:${KeyId},mediaId:video-${Stream.Name},adaptiveGroup:myAbrGroup}
    myExtraAbrStream_1080p={keyId:${KeyIdGenerator.Random},contentId:${KeyId},mediaId:video-${Stream.Name},adaptiveGroup:myAbrGroup}
    *={keyId:${KeyIdGenerator.Random},contentId:${KeyId},mediaId:${Stream.Name}}
    The last entry in the sample file is a "catch-all" wildcard that matches any stream name that isn't matched by any of the lines above. If a catch-all wildcard isn't defined, then any streams that dont' match the rules provided won't be encrypted.

    Deny connections from RTSP, Flash RTMP, and Flash HTTP clients


    To deny RTMP playback, remove the wildcard character (*) from <Access>/<StreamReadAccess> in Application.xml:
    <StreamReadAccess></StreamReadAccess>
    To deny Flash HTTP playback, remove sanjosestreamingpacketizer from the <LiveStreamPacketizers> section and sanjosestreaming from the <HTTPStreamers> section in Application.xml:
    <LiveStreamPacketizers>cupertinostreamingpacketizer,smoothstreamingpacketizer,mpegdashstreamingpacketizer</LiveStreamPacketizers>
    <HTTPStreamers>cupertinostreaming,smoothstreaming,mpegdashstreaming</HTTPStreamers>
    To deny RTSP playback, change <RTP>/<Authentication>/<PlayMethod> to digest:
    <PlayMethod>digest</PlayMethod>

    API to capture keyId, contentId, and mediaId


    To be notified when a stream is started that uses the BuyDRM protection mechanism so you can capture the keyId, contentId, and mediaId used for streaming, you can create a class that implements the IBuyDRMStreamActionNotify inteface and add it as a listener to the BuyDRM module. Following is an example class that implements this interface:
    import com.wowza.wms.application.*;
    import com.wowza.wms.drm.module.buydrm.*;
    import com.wowza.wms.httpstreamer.model.*;
    import com.wowza.wms.logging.*;
    
    public class BuyDRMStreamActionNotifyExample implements IBuyDRMStreamActionNotify
    {
        public void onBuyDRMHTTPSmoothStreamingPlayReadyCreateVOD(IApplicationInstance appInstance, IHTTPStreamerSession httpSession, BuyDRMKeyInfo buyDRMKeyInfo)
        {
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPSmoothStreamingPlayReadyCreateVOD: appInstance: "+appInstance.getContextStr());
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPSmoothStreamingPlayReadyCreateVOD: httpSession: "+httpSession.getSessionId());
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPSmoothStreamingPlayReadyCreateVOD: buyDRMKeyInfo: "+buyDRMKeyInfo.toString());
        }
    
        public void onBuyDRMHTTPSmoothStreamingPlayReadyCreateLive(IApplicationInstance appInstance, String streamName, BuyDRMKeyInfo buyDRMKeyInfo)
        {
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPSmoothStreamingPlayReadyCreateVOD: appInstance: "+appInstance.getContextStr());
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPSmoothStreamingPlayReadyCreateVOD: streamName: "+streamName);
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPSmoothStreamingPlayReadyCreateVOD: buyDRMKeyInfo: "+buyDRMKeyInfo.toString());
        }
    
        public void onBuyDRMHTTPCupertinoStreamingPlayReadyCreateVOD(IApplicationInstance appInstance, IHTTPStreamerSession httpSession, BuyDRMKeyInfo buyDRMKeyInfo)
        {
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPCupertinoStreamingPlayReadyCreateVOD: appInstance: "+appInstance.getContextStr());
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPCupertinoStreamingPlayReadyCreateVOD: httpSession: "+httpSession.getSessionId());
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPCupertinoStreamingPlayReadyCreateVOD: buyDRMKeyInfo: "+buyDRMKeyInfo.toString());
        }
    
        public void onBuyDRMHTTPCupertinoStreamingPlayReadyCreateLive(IApplicationInstance appInstance, String streamName, BuyDRMKeyInfo buyDRMKeyInfo)
        {
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPCupertinoStreamingPlayReadyCreateLive: appInstance: "+appInstance.getContextStr());
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPCupertinoStreamingPlayReadyCreateLive: streamName: "+streamName);
            WMSLoggerFactory.getLogger(null).info("BuyDRMStreamActionNotifyExample.onBuyDRMHTTPCupertinoStreamingPlayReadyCreateLive: buyDRMKeyInfo: "+buyDRMKeyInfo.toString());
        }
    }
    To add this class to your [install-dir]/conf/[application]/Application.xml file, add the following property with the full path to your class to the <Properties> container at the end of the Application.xml file (be sure to get the correct <Properties> container as there are several in the file):
    <Property>
        <Name>drmBuyDRMActionNotifyClass</Name>
        <Value>com.wowza.wms.plugin.test.buydrm.BuyDRMStreamActionNotifyExample</Value>
    </Property>

    API-based stream map


    You can replace the buydrmstreammap.txt file with a Java class that's invoked each time a new stream is to be PlayReady encrypted. An example mapping class looks like this:
    package com.wowza.wms.plugin.test.buydrm;
    
    import com.wowza.wms.application.*;
    import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
    
    public class BuyDRMStreamNameToKeyInfoExample implements IBuyDRMStreamNameToKeyInfo
    {
        private IApplicationInstance appInstance = null;
    
        public void init(IApplicationInstance appInstance)
        {
            this.appInstance = appInstance;
        }
    
        public BuyDRMKeyInfo streamNameToKeyInfo(String typeStr, IApplicationInstance appInstance, String streamName, HTTPStreamerSessionSmoothStreamer httpSession)
        {
            BuyDRMKeyInfo result = null;
            
            if (streamName.equals("sample.mp4"))
            {
                result = new BuyDRMKeyInfo();
                result.setKeyId("F6005DCF-7F93-4B8E-85C7-F908840DA059");
                result.setContentId("F6005DCF-7F93-4B8E-85C7-F908840DA059");
                result.setMediaId("sampletest");
            }
            else if (streamName.startsWith("video-"))
            {
                result = new BuyDRMKeyInfo();
                result.setKeyId("${KeyIdGenerator.SharedSecret}");
                result.setContentId("${KeyId}");
                result.setMediaId("${Stream.Name}");
            }
    
            return result;
        }
        
        
    }
    To use the Java API instead of the map file, replace the drmBuyDRMStreamNameMapFile property with the following property that points to the full path to the custom mapping class:
    <Property>
        <Name>drmBuyDRMStreamNameMapClass</Name>
        <Value>com.wowza.wms.plugin.test.buydrm.BuyDRMStreamNameToKeyInfoExample</Value>
    </Property>
    Note: If the streamNameToKeyInfo returns null, then the stream won't be protected.

    nDVR-specific instructions


    There are a couple of unique instructions for DRM with nDVR.

    • For nDVR, use a URL with a ?DVR query parameter. For example:

      http://localhost:1935/vod/mp4:sample.mp4/Manifest?dvr

    • The DRM module must be enabled during nDVR recording and playback.

    • When using nDVR in an origin-edge scenario, the DRM module must be enabled on both origin and edge.

    • In origin-edge mode, both origin and edges use a common shared secret string to encrypt data sent between instances. The dvrEncryptionSharedSecret or liveRepeaterEncryptionSharedSecret properties may be used to customize the shared secret that's used. See nDVR advanced configuration for specific uses of these properties.


    Originally Published: 01-09-2012.
    Updated: For Wowza Streaming Engine on 04-16-2014.

    If you're having problems or want to discuss this article, post in our forum.