Bagikan melalui


MediaProtectionManager Kelas

Definisi

Berisi objek manajer perlindungan konten untuk aplikasi yang menangani konten media yang dilindungi.

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
Warisan
Object Platform::Object IInspectable MediaProtectionManager
Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10 (diperkenalkan dalam 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v1.0)

Contoh

Contoh berikut menunjukkan cara membuat MediaProtectionManager, mengatur properti Properti , dan menambahkan pendengar peristiwa untuk ComponentLoadFailed dan 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);
}

Keterangan

MediaProtectionManager dapat diteruskan ke infrastruktur pemutaran media dengan salah satu dari dua cara:

  • Sebagai atribut untuk <video> tag atau <audio> menggunakan metode msSetMediaProtectionManager .
  • Langsung ke API pemutaran media. Objek MediaProtectionManager diberi tahu tentang objek pengaktif konten. Objek-objek ini harus diproses oleh aplikasi, untuk membuat akses ke konten yang dilindungi. Setiap objek MediaProtectionManager dikaitkan dengan satu instans pemutaran.

Konstruktor

MediaProtectionManager()

Menginisialisasi instans baru kelas MediaProtectionManager .

Properti

Properties

Mendapatkan objek PropertySet yang berisi properti apa pun yang dilampirkan ke manajer perlindungan.

Acara

ComponentLoadFailed

Diaktifkan saat beban data biner gagal.

RebootNeeded

Diaktifkan saat reboot diperlukan setelah komponen diperbarui.

ServiceRequested

Diaktifkan saat layanan diminta.

Berlaku untuk