MediaProtectionManager 类

定义

包含处理受保护媒体内容的应用程序的内容保护管理器对象。

public ref class MediaProtectionManager sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class MediaProtectionManager final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class MediaProtectionManager final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class MediaProtectionManager
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class MediaProtectionManager
function MediaProtectionManager()
Public NotInheritable Class MediaProtectionManager
继承
Object Platform::Object IInspectable MediaProtectionManager
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

以下示例演示如何创建 MediaProtectionManager、设置 Properties 属性,以及为 ComponentLoadFailedServiceRequested 添加事件侦听器。

private void InitMediaProtectionManager()
{
   mediaProtectionManager = new Windows.Media.Protection.MediaProtectionManager();
   mediaProtectionManager.ServiceRequested += MediaProtectionManager_ServiceRequested;
   mediaProtectionManager.ComponentLoadFailed += MediaProtectionManager_ComponentLoadFailed;
   mediaProtectionManager.RebootNeeded += MediaProtectionManager_RebootNeeded;
}



private void MediaProtectionManager_RebootNeeded(MediaProtectionManager sender)
{
   LogMessage("Reboot Required");
}

private void MediaProtectionManager_ComponentLoadFailed(MediaProtectionManager sender, ComponentLoadFailedEventArgs e)
{
   LogMessage(e.Information.Items.Count.ToString() + " failed components");
   LogMessage("<h2>Components:</h2>");

   //  List the failing components
   for (var i = 0; i < e.Information.Items.Count; i++)
   {
         LogMessage("<h3>" + e.Information.Items[i].Name + "</h3>" +
               "<p>Reasons=0x" + e.Information.Items[i].Reasons.ToString() +
               "<p>Renewal Id=" + e.Information.Items[i].RenewalId);
   }

   e.Completion.Complete(true);
}

private void MediaProtectionManager_ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs e)
{
   LogMessage("Got Enabler - system/type: {" + e.Request.ProtectionSystem + "}/{" + e.Request.Type + "}");
   e.Completion.Complete(true);
}

注解

可以通过以下两种方式之一将 MediaProtectionManager 传递给媒体播放基础结构:

  • 使用 msSetMediaProtectionManager 方法作为 <video><audio> 标记的属性。
  • 直接连接到媒体播放 API。 MediaProtectionManager 对象收到内容启用器对象的通知。 这些对象必须由应用程序处理,才能建立对受保护内容的访问权限。 每个 MediaProtectionManager 对象都与单个播放实例相关联。

构造函数

MediaProtectionManager()

初始化 MediaProtectionManager 类的新实例。

属性

Properties

获取一个 PropertySet 对象,该对象包含附加到保护管理器的任何属性。

事件

ComponentLoadFailed

在加载二进制数据失败时触发。

RebootNeeded

在续订组件后需要重新启动时触发。

ServiceRequested

请求服务时触发。

适用于