Search code examples
c#ffmpeguwpdrmplayready

How to setup FFMPEGInterop to Use DRM playready


I am using FFMPEGInterop class to play UWP video. I need to play it with playready setup but am running into issues.

I can play playready with just mediaplayerelement and creating the protection manager, but when I create a FFMPEGMSS to stream it, than it fails. Says value is out of range when adding the protection manager to the MediaStreamSource.

var StreamSource = FFmpegMSS.GetMediaStreamSource();
var protectionManager = new Windows.Media.Protection.MediaProtectionManager();
Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet();
cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Microsoft.Media.PlayReadyClient.PlayReadyWinRTTrustedInput"); //Playready
protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems);
protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");
protectionManager.ServiceRequested += ProtectionManager_ServiceRequested;
protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed;

protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

var supportsHardwareDrm = PlayReadyStatics.CheckSupportedHardware(PlayReadyHardwareDRMFeatures.HardwareDRM);
if (!supportsHardwareDrm)
{
    protectionManager.Properties["Windows.Media.Protection.UseSoftwareProtectionLayer"] = true;
}
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

Header.Text = supportsHardwareDrm ? "SUPPORTED" : "NOT SUPPRTED";

StreamSource.MediaProtectionManager = protectionManager;

mediaElement.Source = MediaSource.CreateFromMediaStreamSource(StreamSource);

I should be able to play playready DRM with a setup protection manager to start but down get any info on it so confused on the next step for it.


Solution

  • UWP MediaElement does not implement necessary support for PlayReady content coming from external sources. That is, there is no UWP PlayReday playback with FFmpegMSS.

    You can have PlayReady only with Microsoft's own sources for streaming media.