媒体服务 PlayReady 许可证模板概述Media Services PlayReady license template overview

Azure 媒体服务现在提供了用于交付 PlayReady 许可证的服务。Azure Media Services now provides a service for delivering PlayReady licenses. 当播放器(例如 Silverlight)尝试播放受 PlayReady 保护的内容时,将向许可证交付服务发送请求以获取许可证。When the player (for example, Silverlight) tries to play your PlayReady-protected content, a request is sent to the license delivery service to obtain a license. 如果许可证服务批准了该请求,则会颁发该许可证,该许可证将发送到客户端,并用来解密和播放指定的内容。If the license service approves the request, it issues the license that is sent to the client and is used to decrypt and play the specified content.

媒体服务还提供了可以用来配置 PlayReady 许可证的 API。Media Services also provides APIs that you can use to configure your PlayReady licenses. 许可证包含了当用户尝试播放受保护的内容时要由 PlayReady 数字版权管理 (DRM) 运行时强制实施的权限和限制。Licenses contain the rights and restrictions that you want the PlayReady digital rights management (DRM) runtime to enforce when a user tries to play back protected content. 下面是可以指定的 PlayReady 许可证限制的一些示例:Here are some examples of PlayReady license restrictions that you can specify:

  • 该许可证开始生效的日期和时间。The date and time from which the license is valid.
  • 许可证过期时的日期/时间值。The DateTime value when the license expires.
  • 要在客户端的永久性存储区保存的许可证。For the license to be saved in persistent storage on the client. 永久性许可证通常用于允许脱机播放内容。Persistent licenses are typically used to allow offline playback of the content.
  • 播放器必须具有的要播放内容的最低安全级别。The minimum security level that a player must have to play your content.
  • 音频\视频内容的输入控件的输出保护级别。The output protection level for the output controls for audio\video content.
  • 有关详细信息,请参阅 PlayReady 符合性规则文档中的“输出控件”部分 (3.5)。For more information, see the "Output Controls" section (3.5) in the PlayReady Compliance Rules document.

备注

目前,只能配置 PlayReady 许可证的 PlayRight。Currently, you can only configure the PlayRight of the PlayReady license. 此权限是必需的。This right is required. PlayRight 赋予客户端播放内容的权限。The PlayRight gives the client the ability to play back the content. 还可以使用 PlayRight 配置特定于播放的限制。You also can use the PlayRight to configure restrictions specific to playback. 有关详细信息,请参阅 PlayReadyPlayRightFor more information, see PlayReadyPlayRight.

若要使用媒体服务配置 PlayReady 许可证,必须配置媒体服务 PlayReady 许可证模板。To configure PlayReady licenses by using Media Services, you must configure the Media Services PlayReady license template. 该模板在 XML 中定义。The template is defined in XML.

下例演示了配置基本的流式处理许可证的最简单(也是最常见的)模板。The following example shows the simplest (and most common) template that configures a basic streaming license. 使用此许可证时,客户端可以播放受 PlayReady 保护的内容。With this license, your clients can play back your PlayReady-protected content.

<?xml version="1.0" encoding="utf-8"?>
<PlayReadyLicenseResponseTemplate xmlns:i="https://www.w3.org/2001/XMLSchema-instance" 
                                  xmlns="http://schemas.microsoft.com/Azure/MediaServices/KeyDelivery/PlayReadyTemplate/v1">
  <LicenseTemplates>
    <PlayReadyLicenseTemplate>
      <ContentKey i:type="ContentEncryptionKeyFromHeader" />
      <PlayRight />
    </PlayReadyLicenseTemplate>
  </LicenseTemplates>
</PlayReadyLicenseResponseTemplate>

XML 遵循“PlayReady 许可证模板 XML 架构”部分中定义的 PlayReady 许可证模板 XML 架构。The XML conforms to the PlayReady license template XML schema defined in the "PlayReady license template XML schema" section.

媒体服务还可定义一组可用于序列化到 XML 和从 XML 反序列化的 .NET 类。Media Services also defines a set of .NET classes that can be used to serialize and deserialize to and from the XML. 有关主要类的说明,请参阅用于配置许可证模板的媒体服务 .NET 类For a description of the main classes, see the Media Services .NET classes that are used to configure license templates.

有关使用 .NET 类来配置 PlayReady 许可证模板的端到端示例,请参阅使用 PlayReady 动态加密和许可证交付服务For an end-to-end example that uses .NET classes to configure the PlayReady license template, see Use PlayReady dynamic encryption and the license delivery service.

用于配置许可证模板的媒体服务 .NET 类Media Services .NET classes that are used to configure license templates

下列类是用于配置媒体服务 PlayReady 许可证模板的主要 .NET 类。The following classes are the main .NET classes that are used to configure Media Services PlayReady license templates. 这些类映射到 PlayReady 许可证模板 XML 架构中定义的类型。These classes map to the types defined in PlayReady license template XML schema.

MediaServicesLicenseTemplateSerializer 类用于序列化到媒体服务许可证模板 XML 和从该 XML 进行反序列化。The MediaServicesLicenseTemplateSerializer class is used to serialize and deserialize to and from the Media Services license template XML.

PlayReadyLicenseResponseTemplatePlayReadyLicenseResponseTemplate

PlayReadyLicenseResponseTemplate:此类表示发送回用户的响应的模板。PlayReadyLicenseResponseTemplate: This class represents the template for the response sent back to the user. 它包含一个在许可证服务器与应用程序之间使用的自定义数据字符串的字段(对于自定义应用逻辑可能比较有用)。It contains a field for a custom data string between the license server and the application (which might be useful for custom app logic). 它还包含一个内含一个或多个许可证模板的列表。It also contains a list of one or more license templates.

作为模板层次结构中的“顶层”类,响应模板包含一个许可证模板列表。As the "top-level" class in the template hierarchy, the response template includes a list of license templates. 许可证模板(直接或间接)包含构成要序列化的模板数据的所有其他类。The license templates include (directly or indirectly) all the other classes that make up the template data to be serialized.

PlayReadyLicenseTemplatePlayReadyLicenseTemplate

PlayReadyLicenseTemplate:此类表示用于创建要返回给用户的 PlayReady 许可证的许可证模板。PlayReadyLicenseTemplate: This class represents a license template that is used to create PlayReady licenses to be returned to users. 它包含关于许可证中的内容密钥的数据。It contains the data on the content key in the license. 它还包括当使用内容密钥时,PlayReady DRM 运行时必须强制实施的任何权限或限制。It also includes any rights or restrictions that the PlayReady DRM runtime must enforce when the content key is used.

PlayReadyPlayRightPlayReadyPlayRight

PlayReadyPlayRight:此类表示 PlayReady 许可证的 PlayRight。PlayReadyPlayRight: This class represents the PlayRight of a PlayReady license. 它授权用户播放受许可证中和 PlayRight 本身(对于特定于播放的策略)配置的任何限制所制约的内容。It grants the user the ability to play back the content subject to any restrictions configured in the license and on the PlayRight itself (for playback-specific policy). 针对 PlayRight 的策略大部分涉及输出限制,这些限制控制在播放内容时可以使用的输出类型。Much of the policy on a PlayRight concerns output restrictions that control the types of outputs that the content can be played over. 它还包括在使用给定输出时必须实施的任何限制。It also includes any restrictions that must be put in place when a given output is used. 例如,如果启用了 DigitalVideoOnlyContentRestriction,则 DRM 运行时仅允许以数字输出形式播放视频。For example, if DigitalVideoOnlyContentRestriction is enabled, the DRM runtime only allows the video to be displayed over digital outputs. (不允许以模拟视频输出形式来传送内容。)(Analog video outputs aren't allowed to pass the content.)

重要

这些类型的限制可能很有效,但也会影响使用者体验。These types of restrictions can be powerful, but they also can affect the consumer experience. 如果输出保护施加了太多限制,内容可能会无法在某些客户端上播放。If the output protections are too restrictive, the content might be unplayable on some clients. 有关详细信息,请参阅 PlayReady 符合性规则For more information, see the PlayReady Compliance Rules.

有关 Silverlight 支持的保护级别的示例,请参阅 Silverlight 支持的输出保护For an example of the protection levels that Silverlight supports, see Silverlight support for output protections.

PlayReady 许可证模板 XML 架构PlayReady license template XML schema

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/Azure/MediaServices/KeyDelivery/PlayReadyTemplate/v1" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Azure/MediaServices/KeyDelivery/PlayReadyTemplate/v1" xmlns:xs="https://www.w3.org/2001/XMLSchema">
  <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
  <xs:complexType name="AgcAndColorStripeRestriction">
    <xs:sequence>
      <xs:element minOccurs="0" name="ConfigurationData" type="xs:unsignedByte" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="AgcAndColorStripeRestriction" nillable="true" type="tns:AgcAndColorStripeRestriction" />
  <xs:simpleType name="ContentType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Unspecified" />
      <xs:enumeration value="UltravioletDownload" />
      <xs:enumeration value="UltravioletStreaming" />
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="ContentType" nillable="true" type="tns:ContentType" />
  <xs:complexType name="ExplicitAnalogTelevisionRestriction">
    <xs:sequence>
      <xs:element minOccurs="0" name="BestEffort" type="xs:boolean" />
      <xs:element minOccurs="0" name="ConfigurationData" type="xs:unsignedByte" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ExplicitAnalogTelevisionRestriction" nillable="true" type="tns:ExplicitAnalogTelevisionRestriction" />
  <xs:complexType name="PlayReadyContentKey">
    <xs:sequence />
  </xs:complexType>
  <xs:element name="PlayReadyContentKey" nillable="true" type="tns:PlayReadyContentKey" />
  <xs:complexType name="ContentEncryptionKeyFromHeader">
    <xs:complexContent mixed="false">
      <xs:extension base="tns:PlayReadyContentKey">
        <xs:sequence />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="ContentEncryptionKeyFromHeader" nillable="true" type="tns:ContentEncryptionKeyFromHeader" />
  <xs:complexType name="ContentEncryptionKeyFromKeyIdentifier">
    <xs:complexContent mixed="false">
      <xs:extension base="tns:PlayReadyContentKey">
        <xs:sequence>
          <xs:element minOccurs="0" name="KeyIdentifier" type="ser:guid" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:element name="ContentEncryptionKeyFromKeyIdentifier" nillable="true" type="tns:ContentEncryptionKeyFromKeyIdentifier" />
  <xs:complexType name="PlayReadyLicenseResponseTemplate">
    <xs:sequence>
      <xs:element name="LicenseTemplates" nillable="true" type="tns:ArrayOfPlayReadyLicenseTemplate" />
      <xs:element minOccurs="0" name="ResponseCustomData" nillable="true" type="xs:string">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="PlayReadyLicenseResponseTemplate" nillable="true" type="tns:PlayReadyLicenseResponseTemplate" />
  <xs:complexType name="ArrayOfPlayReadyLicenseTemplate">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="PlayReadyLicenseTemplate" nillable="true" type="tns:PlayReadyLicenseTemplate" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ArrayOfPlayReadyLicenseTemplate" nillable="true" type="tns:ArrayOfPlayReadyLicenseTemplate" />
  <xs:complexType name="PlayReadyLicenseTemplate">
    <xs:sequence>
      <xs:element minOccurs="0" name="AllowTestDevices" type="xs:boolean" />
      <xs:element minOccurs="0" name="BeginDate" nillable="true" type="xs:dateTime">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element name="ContentKey" nillable="true" type="tns:PlayReadyContentKey" />
      <xs:element minOccurs="0" name="ContentType" type="tns:ContentType">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="ExpirationDate" nillable="true" type="xs:dateTime">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="GracePeriod" nillable="true" type="ser:duration">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="LicenseType" type="tns:PlayReadyLicenseType" />
      <xs:element minOccurs="0" name="PlayRight" nillable="true" type="tns:PlayReadyPlayRight" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="PlayReadyLicenseTemplate" nillable="true" type="tns:PlayReadyLicenseTemplate" />
  <xs:simpleType name="PlayReadyLicenseType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Nonpersistent" />
      <xs:enumeration value="Persistent" />
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="PlayReadyLicenseType" nillable="true" type="tns:PlayReadyLicenseType" />
  <xs:complexType name="PlayReadyPlayRight">
    <xs:sequence>
      <xs:element minOccurs="0" name="AgcAndColorStripeRestriction" nillable="true" type="tns:AgcAndColorStripeRestriction">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="AllowPassingVideoContentToUnknownOutput" type="tns:UnknownOutputPassingOption">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="AnalogVideoOpl" nillable="true" type="xs:int">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="CompressedDigitalAudioOpl" nillable="true" type="xs:int">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="CompressedDigitalVideoOpl" nillable="true" type="xs:int">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="DigitalVideoOnlyContentRestriction" type="xs:boolean">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="ExplicitAnalogTelevisionOutputRestriction" nillable="true" type="tns:ExplicitAnalogTelevisionRestriction">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="FirstPlayExpiration" nillable="true" type="ser:duration">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="ImageConstraintForAnalogComponentVideoRestriction" type="xs:boolean">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="ImageConstraintForAnalogComputerMonitorRestriction" type="xs:boolean">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="ScmsRestriction" nillable="true" type="tns:ScmsRestriction">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="UncompressedDigitalAudioOpl" nillable="true" type="xs:int">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="UncompressedDigitalVideoOpl" nillable="true" type="xs:int">
        <xs:annotation>
          <xs:appinfo>
            <DefaultValue EmitDefaultValue="false" xmlns="http://schemas.microsoft.com/2003/10/Serialization/" />
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="PlayReadyPlayRight" nillable="true" type="tns:PlayReadyPlayRight" />
  <xs:simpleType name="UnknownOutputPassingOption">
    <xs:restriction base="xs:string">
      <xs:enumeration value="NotAllowed" />
      <xs:enumeration value="Allowed" />
      <xs:enumeration value="AllowedWithVideoConstriction" />
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="UnknownOutputPassingOption" nillable="true" type="tns:UnknownOutputPassingOption" />
  <xs:complexType name="ScmsRestriction">
    <xs:sequence>
      <xs:element minOccurs="0" name="ConfigurationData" type="xs:unsignedByte" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="ScmsRestriction" nillable="true" type="tns:ScmsRestriction" />
</xs:schema>

媒体服务学习路径Media Services learning paths

媒体服务 v3(最新版本)Media Services v3 (latest)

查看最新版本的 Azure 媒体服务!Check out the latest version of Azure Media Services!

媒体服务 v2(旧版)Media Services v2 (legacy)