MediaProtectionManager 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
包含處理受保護媒體內容之應用程式的內容保護管理員物件。
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
- 繼承
- 屬性
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
範例
下列範例示範如何建立 MediaProtectionManager、設定 Properties 屬性,以及新增 ComponentLoadFailed 和 ServiceRequested的事件接聽程式。
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 |
要求服務時引發。 |