Beispiel #1
0
        private async void ProtectionManager_ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs e)
        {
            Log("ProtectionManager_ServiceRequested");

            if (e.Request is PlayReadyIndividualizationServiceRequest)
            {
                Log("ProtectionManager_ServiceRequested: PlayReadyIndividualizationServiceRequest");

                PlayReadyIndividualizationServiceRequest individualizationServiceRequest = (PlayReadyIndividualizationServiceRequest)e.Request;
                await individualizationServiceRequest.BeginServiceRequest();

                Log("ProtectionManager_ServiceRequested: PlayReadyIndividualizationServiceRequest complete");
                e.Completion.Complete(true);
            }
            else if (e.Request is PlayReadyLicenseAcquisitionServiceRequest)
            {
                Log("ProtectionManager_ServiceRequested: PlayReadyLicenseAcquisitionServiceRequest");

                PlayReadyLicenseAcquisitionServiceRequest licenseAcquisitionRequest = (PlayReadyLicenseAcquisitionServiceRequest)e.Request;
                await licenseAcquisitionRequest.BeginServiceRequest();

                Log("ProtectionManager_ServiceRequested: PlayReadyLicenseAcquisitionServiceRequest complete");
                e.Completion.Complete(true);
            }
        }
Beispiel #2
0
        private async void OnMediaProtectionManagerServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs e)
        {
            Debug.WriteLine("ProtectionManager ServiceRequested");

            _serviceCompletionNotifier = e.Completion;
            IPlayReadyServiceRequest serviceRequest = (IPlayReadyServiceRequest)e.Request;

            Debug.WriteLine("Servie request type = " + serviceRequest.GetType());

            var result = false;

            if (serviceRequest.Type == PlayReadyStatics.IndividualizationServiceRequestType)
            {
                result = await PlayReadyLicenseHandler.RequestIndividualizationToken(serviceRequest as PlayReadyIndividualizationServiceRequest);
            }
            else if (serviceRequest.Type == PlayReadyStatics.LicenseAcquirerServiceRequestType)
            {
                // NOTE: You might need to set the request.ChallengeCustomData, depending on your Rights Manager.
                if (RequestConfigData != null)
                {
                    _requestChain = new RequestChain(serviceRequest);
                    _requestChain.RequestConfigData = this.RequestConfigData;
                    _requestChain.FinishAndReportResult(HandleServiceRequest_Finished);

                    return;
                }
                else
                {
                    result = await PlayReadyLicenseHandler.RequestLicense(serviceRequest as PlayReadyLicenseAcquisitionServiceRequest);
                }
            }

            _serviceCompletionNotifier.Complete(result);
        }
Beispiel #3
0
        private async void OnMediaProtectionManagerServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs e)
        {
            Debug.WriteLine("ProtectionManager ServiceRequested");

            var completionNotifier = e.Completion;
            var request            = (IPlayReadyServiceRequest)e.Request;

            var result = false;

            if (request.Type == PlayReadyStatics.IndividualizationServiceRequestType)
            {
                result = await PlayReadyLicenseHandler.RequestIndividualizationToken(request as PlayReadyIndividualizationServiceRequest);
            }
            else if (request.Type == PlayReadyStatics.LicenseAcquirerServiceRequestType)
            {
                // NOTE: You might need to set the request.ChallengeCustomData, depending on your Rights Manager.
                if (!string.IsNullOrEmpty(arguments.RightsManagerUrl))
                {
                    request.Uri = new Uri(arguments.RightsManagerUrl);
                }

                result = await PlayReadyLicenseHandler.RequestLicense(request as PlayReadyLicenseAcquisitionServiceRequest);
            }

            completionNotifier.Complete(result);
        }
        private void SetUpProtectionManager(ref MediaElement m)
        {
            log("Enter SetUpProtectionManager");

            log("Creating protection system mappings...");
            protectionManager = new MediaProtectionManager();

            protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ProtectionManager_ComponentLoadFailed);
            protectionManager.ServiceRequested    += new ServiceRequestedEventHandler(ProtectionManager_ServiceRequested);

            //Setup PlayReady as the ProtectionSystem to use by MF.
            //The code here is mandatory and should be just copied directly over to the app
            Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet();

            cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems);

            //Use by the media stream source about how to create ITA InitData.
            //See here for more detai: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");

            // Setup the container GUID that's in the PPSH box
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            m.ProtectionManager = protectionManager;

            log("Leave SetUpProtectionManager");
        }
Beispiel #5
0
        /// <summary>Initializes the PlayReady protection manager.</summary>
        private void InitializeMediaProtectionManager()
        {
            var mediaProtectionManager = new MediaProtectionManager();

            mediaProtectionManager.ComponentLoadFailed += OnMediaProtectionManagerComponentLoadFailed;
            mediaProtectionManager.ServiceRequested    += OnMediaProtectionManagerServiceRequested;

            // Set up the container GUID for the CFF format (used with DASH streams), see http://uvdemystified.com/uvfaq.html#3.2
            // The GUID represents MPEG DASH Content Protection using Microsoft PlayReady, see http://dashif.org/identifiers/protection/
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionContainerGuid"] = "{9A04F079-9840-4286-AB92-E65BE0885F95}";

            // Set up the drm layer to use. Hardware DRM is the default, but not all older hardware supports this
            var supportsHardwareDrm = PlayReadyStatics.CheckSupportedHardware(PlayReadyHardwareDRMFeatures.HardwareDRM);

            if (!supportsHardwareDrm)
            {
                mediaProtectionManager.Properties["Windows.Media.Protection.UseSoftwareProtectionLayer"] = true;
            }

            // Set up the content protection manager so it uses the PlayReady Input Trust Authority (ITA) for the relevant media sources
            // The MediaProtectionSystemId GUID is format and case sensitive, see https://msdn.microsoft.com/en-us/library/windows.media.protection.mediaprotectionmanager.properties.aspx
            var cpsystems = new PropertySet();

            cpsystems[PlayReadyStatics.MediaProtectionSystemId.ToString("B").ToUpper()] = "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput";
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemIdMapping"] = cpsystems;
            mediaProtectionManager.Properties["Windows.Media.Protection.MediaProtectionSystemId"]        = PlayReadyStatics.MediaProtectionSystemId.ToString("B").ToUpper();

            Player.ProtectionManager = mediaProtectionManager;
        }
        public PlayReadyPage()
        {
            this.InitializeComponent();

            this.navigationHelper            = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

            var protectionManager = new MediaProtectionManager();

            protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed;
            protectionManager.ServiceRequested    += ProtectionManager_ServiceRequested;

            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}");

            player.ProtectionManager = protectionManager;

            var extensions = player.MediaExtensionManager;

            extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".pyv", "PRvideo");
            extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".pya", "PRaudio");
            extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".wma", "PRaudio");
            extensions.RegisterByteStreamHandler("Microsoft.Media.PlayReadyClient.PlayReadyByteStreamHandler", ".wmv", "PRvideo");
        }
Beispiel #7
0
        public void SetUpProtectionManager(MediaPlayer mediaPlayer)
        {
            Log("Enter SetUpProtectionManager");

            if (mediaPlayer == null)
            {
                throw new ArgumentException("SetUpProtectionManager was passed a null MediaPlayer");
            }

            Log("Creating protection system mappings...");
            var protectionManager = new MediaProtectionManager();

            protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ProtectionManager_ComponentLoadFailed);
            protectionManager.ServiceRequested    += new ServiceRequestedEventHandler(ProtectionManager_ServiceRequested);

            // The code here is mandatory and should be just copied directly over to the app
            // Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx

            // Setup PlayReady as the ProtectionSystem to use by mediaFoundation:
            var contentProtectionSystems = new PropertySet();

            contentProtectionSystems.Add(PlayReadyWinRTTrustedInput);
            protectionManager.Properties.Add(MediaProtectionSystemIdMapping, contentProtectionSystems);
            protectionManager.Properties.Add(MediaProtectionSystemId);
            protectionManager.Properties.Add(MediaProtectionContainerGuid);

            mediaPlayer.ProtectionManager = protectionManager;

            Log("Leave SetUpProtectionManager");
        }
Beispiel #8
0
        void ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs srEvent)
        {
            serviceCompletionNotifier = srEvent.Completion;
            IPlayReadyServiceRequest serviceRequest = (IPlayReadyServiceRequest)srEvent.Request;

            ViewModelBase.Log(serviceRequest.GetType().Name);
            ProcessServiceRequest(serviceRequest);
        }
Beispiel #9
0
 /// <summary>
 /// A ComponentLoadFailed event will occur when binary data fails to load.
 /// This an infrequent event that may be triggered by a pending OS update in which DRM compoments
 /// are being renewed and may require a restart.
 /// </summary>
 static void ComponentLoadFailed(MediaProtectionManager sender, ComponentLoadFailedEventArgs e)
 {
     for (int i = 0; i < e.Information.Items.Count; i++)
     {
         ViewModelBase.Log(e.Information.Items[i].Name + "\nReasons=0x" + e.Information.Items[i].Reasons + "\n"
                           + "Renewal Id=" + e.Information.Items[i].RenewalId);
     }
     e.Completion.Complete(false);
 }
Beispiel #10
0
        void SetupProtectionManager(MediaElement mediaElement)
        {
            TestLogger.LogMessage("Enter Playback.SetupProtectionManager()");

            _mediaElement = mediaElement;

            TestLogger.LogMessage("Creating protection system mappings...");
            _protectionManager = new MediaProtectionManager();

            _protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ProtectionManager_ComponentLoadFailed);
            _protectionManager.ServiceRequested    += new ServiceRequestedEventHandler(ProtectionManager_ServiceRequested);

            TestLogger.LogMessage("Creating protection system mappings...");
            //Setup PlayReady as the ProtectionSystem to use by MF.
            //The code here is mandatory and should be just copied directly over to the app
            Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet();

            //Indicate to the MF pipeline to use PlayReady's TrustedInput
            cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems);
            //Use by the media stream source about how to create ITA InitData.
            //See here for more detai: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx
            _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");

            // Setup the container GUID that's in the PPSH box
            _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            TestLogger.LogMessage("Creating media extension manager...");
            _extensions = new Windows.Media.MediaExtensionManager();

            TestLogger.LogMessage("Registering ByteStreamHandlers for PIFF content");
            _extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml");
            _extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml");

            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            //Setup Software Override based on app setting
            //By default, PlayReady uses Hardware DRM if the machine support it. However, in case the app still want
            //software behavior, they can set localSettings.Containers["PlayReady"].Values["SoftwareOverride"]=1.
            //This code tells MF to use software override as well
            if (localSettings.Containers.ContainsKey("PlayReady") &&
                localSettings.Containers["PlayReady"].Values.ContainsKey("SoftwareOverride"))
            {
                int UseSoftwareProtectionLayer = (int)localSettings.Containers["PlayReady"].Values["SoftwareOverride"];

                if (UseSoftwareProtectionLayer == 1)
                {
                    TestLogger.LogMessage(" ");
                    TestLogger.LogMessage("***** Use Software Protection Layer ******");
                    _protectionManager.Properties.Add("Windows.Media.Protection.UseSoftwareProtectionLayer", true);
                }
            }

            _mediaElement.ProtectionManager = _protectionManager;

            TestLogger.LogMessage("Leave Playback.SetProtectionManager()");
        }
Beispiel #11
0
        void ProtectionManager_ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs srEvent)
        {
            _serviceCompletionNotifier = srEvent.Completion;
            IPlayReadyServiceRequest serviceRequest = (IPlayReadyServiceRequest)srEvent.Request;

            _requestChain = new RequestChain(serviceRequest);
            _requestChain.LicenseRequestUri = new Uri(LAURL);
            _requestChain.RequestConfigData = this.RequestConfigData;
            _requestChain.FinishAndReportResult(new ReportResultDelegate(HandleServiceRequest_Finished));
        }
        public void configMediaProtectionManager(MediaProtectionManager mediaProtectionManager)
        {
            //This handles the proactive LA of in memory license.
            if (this.licenseSession == null)
            {
                createLicenseSession();
            }

            //LicenseSession will set the proper setting in the media protection manager so that
            //MF knows which existing media session to use and to use PlayReady as the DRM system
            this.licenseSession.ConfigureMediaProtectionManager(mediaProtectionManager);
        }
Beispiel #13
0
        public MainPage()
        {
            this.InitializeComponent();

            var protectionManager = new MediaProtectionManager();

            //A setting to tell MF that we are using PlayReady.
            var props = new Windows.Foundation.Collections.PropertySet();

            props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props);
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");

            //Maps the container guid from the manifest or media segment
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            protectionManager.ServiceRequested    += ProtectionManager_ServiceRequested;
            protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed;

            // media player
            MediaPlayer mediaPlayer = new MediaPlayer();

            mediaPlayer.MediaOpened += MediaPlayer_MediaOpened;
            mediaPlayer.MediaFailed += MediaPlayer_MediaFailed;

            // media source
#if true
            AudioEncodingProperties audioProperties = AudioEncodingProperties.CreateAacAdts(44100, 1, 72000);
            Guid MF_SD_PROTECTED = new Guid(0xaf2181, 0xbdc2, 0x423c, 0xab, 0xca, 0xf5, 0x3, 0x59, 0x3b, 0xc1, 0x21);
            //audioProperties.Properties.Add(MF_SD_PROTECTED, 1 /* true ? doc says UINT32 - treat as a boolean value */);
            audioProperties.Properties.Add(MF_SD_PROTECTED, PropertyValue.CreateUInt32(1));
            AudioStreamDescriptor audioStreamDescriptor = new AudioStreamDescriptor(audioProperties);
            foreach (var prop in audioStreamDescriptor.EncodingProperties.Properties)
            {
                Log(prop.Key.ToString() + " => " + prop.Value.ToString());
            }
            MediaStreamSource mediaStreamSource = new MediaStreamSource(audioStreamDescriptor);
            mediaStreamSource.MediaProtectionManager = protectionManager;   // protection manager is on the media stream source
            mediaStreamSource.SampleRequested       += MediaStreamSource_SampleRequested;
            mediaStreamSource.Starting += MediaStreamSource_Starting;
            MediaSource mediaSource = MediaSource.CreateFromMediaStreamSource(mediaStreamSource);
#else
            MediaSource mediaSource = MediaSource.CreateFromUri(new Uri("http://profficialsite.origin.mediaservices.windows.net/c51358ea-9a5e-4322-8951-897d640fdfd7/tearsofsteel_4k.ism/manifest(format=mpd-time-csf)"));
            mediaPlayer.ProtectionManager = protectionManager;              // protection manager is on the media player
#endif

            // play !
            m_mediaPlayerElement.SetMediaPlayer(mediaPlayer);
            mediaPlayer.Source = mediaSource;
            mediaPlayer.Play();
        }
Beispiel #14
0
        void InitPlayReady()
        {
            var protectionManager = new MediaProtectionManager();

            protectionManager.ComponentLoadFailed += ProtectionManager_ComponentLoadFailed;
            protectionManager.ServiceRequested    += ProtectionManager_ServiceRequested;

            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}");

            player.ProtectionManager = protectionManager;
        }
Beispiel #15
0
        void ProtectionManager_ComponentLoadFailed(MediaProtectionManager sender, ComponentLoadFailedEventArgs e)
        {
            TestLogger.LogMessage("Enter Playback.ProtectionManager_ComponentLoadFailed()");
            TestLogger.LogMessage(e.Information.ToString());

            //  List the failing components - RevocationAndRenewalInformation
            for (int i = 0; i < e.Information.Items.Count; i++)
            {
                TestLogger.LogMessage(e.Information.Items[i].Name + "\nReasons=0x" + e.Information.Items[i].Reasons + "\n"
                                      + "Renewal Id=" + e.Information.Items[i].RenewalId);
            }
            e.Completion.Complete(false);
            TestLogger.LogMessage("Leave Playback.ProtectionManager_ComponentLoadFailed()");
        }
Beispiel #16
0
        void ProtectionManager_ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs srEvent)
        {
            TestLogger.LogMessage("Enter Playback.ProtectionManager_ServiceRequested()");

            _serviceCompletionNotifier = srEvent.Completion;
            IPlayReadyServiceRequest serviceRequest = ( IPlayReadyServiceRequest )srEvent.Request;

            TestLogger.LogMessage("Servie request type = " + serviceRequest.GetType());

            _requestChain = new RequestChain(serviceRequest);
            _requestChain.RequestConfigData = this.RequestConfigData;
            _requestChain.FinishAndReportResult(new ReportResultDelegate(HandleServiceRequest_Finished));

            TestLogger.LogMessage("Leave Playback.ProtectionManager_ServiceRequested()");
        }
Beispiel #17
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            var codecQuery = new CodecQuery();
            IReadOnlyList <CodecInfo> result;

            try
            {
                result = await codecQuery.FindAllAsync(CodecKind.Video, CodecCategory.Decoder, CodecSubtypes.VideoFormatHevc);
            }
            catch (Exception ex)
            {
                throw;
            }

            StringBuilder sb = new StringBuilder();

            foreach (var codecInfo in result)
            {
                sb.Append("============================================================\n");
                sb.Append(string.Format("Codec: {0}\n", codecInfo.DisplayName));
                sb.Append(string.Format("Kind: {0}\n", codecInfo.Kind.ToString()));
                sb.Append(string.Format("Category: {0}\n", codecInfo.Category.ToString()));
                sb.Append(string.Format("Trusted: {0}\n", codecInfo.IsTrusted.ToString()));

                foreach (string subType in codecInfo.Subtypes)
                {
                    sb.Append(string.Format("   Subtype: {0}\n", subType));
                }
            }

            Debug.WriteLine(sb.ToString());

            _player              = new MediaPlayer();
            _player.MediaFailed += Player_MediaFailed;
            _player.AutoPlay     = true;
            _player.PlaybackSession.BufferingStarted += PlaybackSession_BufferingStarted;
            _player.BufferingStarted += Player_BufferingStarted;
            _player.PlaybackSession.PlaybackStateChanged += PlaybackSession_PlaybackStateChanged;

            _protectionManager        = PlayReadyHelpers.InitializeProtectionManager(ServiceRequested);
            _player.ProtectionManager = _protectionManager;

            //_playReadyHelper = new PlayReadyHelper(); // From SDKTemplate.Helpers.PlayReadyHelper
            //_playReadyHelper.SetUpProtectionManager(_player);

            mediaPlayerElement.SetMediaPlayer(_player);
            mediaPlayerElement.AutoPlay = true;
        }
Beispiel #18
0
        private void ProtectionManager_ComponentLoadFailed(MediaProtectionManager sender, ComponentLoadFailedEventArgs e)
        {
            Log("Enter ProtectionManager_ComponentLoadFailed");
            Log(e.Information.ToString());

            // List the failing components - RevocationAndRenewalInformation
            foreach (var item in e.Information.Items)
            {
                Log(item.Name +
                    "\nReasons=0x" + item.Reasons +
                    "\nRenewal Id=" + item.RenewalId);
            }
            e.Completion.Complete(false);

            Log("Leave ProtectionManager_ComponentLoadFailed");
        }
Beispiel #19
0
        private async void ProtectionManager_ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs e)
        {
            Log("Enter ProtectionManager_ServiceRequested");

            if (e.Request is PlayReadyIndividualizationServiceRequest)
            {
                var  individualizationRequest = e.Request as PlayReadyIndividualizationServiceRequest;
                bool bResultIndiv             = await ReactiveIndividualizationRequestAsync(individualizationRequest, e.Completion);
            }
            else if (e.Request is PlayReadyLicenseAcquisitionServiceRequest)
            {
                var licenseRequest = e.Request as PlayReadyLicenseAcquisitionServiceRequest;
                LicenseAcquisitionRequest(licenseRequest, e.Completion, playReadyLicenseUrl, playReadyChallengeCustomData);
            }

            Log("Leave ProtectionManager_ServiceRequested");
        }
        public MainPage()
        {
            this.InitializeComponent();

            //<SnippetSetUpMediaProtectionManager>
            MediaProtectionManager protectionManager = new MediaProtectionManager();

            protectionManager.Properties.Add(
                "Windows.Media.Protection.MediaProtectionContainerGuid",
                PlayReadyStatics.ProtectionSystemId.ToString());
            Windows.Foundation.Collections.PropertySet cpSystems =
                new Windows.Foundation.Collections.PropertySet();
            cpSystems.Add(
                PlayReadyStatics.MediaProtectionSystemId.ToString(),
                PlayReadyStatics.InputTrustAuthorityToCreate);
            //</SnippetSetUpMediaProtectionManager>
        }
Beispiel #21
0
        static public MediaProtectionManager InitializeProtectionManager(ServiceRequestedEventHandler serviceRequestHandler)
        {
            var protectionManager = new MediaProtectionManager();

            //A setting to tell MF that we are using PlayReady.
            var props = new Windows.Foundation.Collections.PropertySet();

            props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props);
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");
            //Maps the conatiner guid from the manifest or media segment
            protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            protectionManager.ServiceRequested    += new ServiceRequestedEventHandler(serviceRequestHandler);
            protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ComponentLoadFailed);

            // Windows 10 provides built in support for Dash and does not require additional configuration.
            // This would be be good place to configure a MediaExtensionManager to support another stream source
            // such as the Smooth Streaming SDK

            return(protectionManager);
        }
Beispiel #22
0
        // Method not used in this sample.
        // This shows the minimal configuration for basic reactive playback.
        public void MinConfig(MediaElement mediaElement)
        {
            var manager = new MediaProtectionManager();
            var props   = new Windows.Foundation.Collections.PropertySet();

            props.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput");
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", props);
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}");
            manager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}");

            MediaProtectionServiceCompletion completionNotifer = null;

            manager.ServiceRequested += async(sender, srEvent) =>
            {
                completionNotifer = srEvent.Completion;
                var serviceRequest = (IPlayReadyServiceRequest)srEvent.Request;

                ProcessServiceRequest(serviceRequest);
                if (serviceRequest is PlayReadyIndividualizationServiceRequest)
                {
                    var indivRequest = serviceRequest as PlayReadyIndividualizationServiceRequest;
                    await indivRequest.BeginServiceRequest();

                    serviceCompletionNotifier.Complete(true);
                }
                else if (serviceRequest is PlayReadyLicenseAcquisitionServiceRequest)
                {
                    var licenseRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;
                    //licenseRequest.
                    await licenseRequest.BeginServiceRequest();

                    serviceCompletionNotifier.Complete(true);
                    serviceCompletionNotifier = null;
                }
            };
            mediaElement.ProtectionManager = manager;
        }
Beispiel #23
0
 void ProtectionManager_ComponentLoadFailed(MediaProtectionManager sender, ComponentLoadFailedEventArgs e)
 {
     e.Completion.Complete(false);
 }
Beispiel #24
0
 private void ProtectionManager_ComponentLoadFailed(MediaProtectionManager sender, ComponentLoadFailedEventArgs e)
 {
     Log("ProtectionManager_ComponentLoadFailed");
 }
Beispiel #25
0
 private void OnMediaProtectionManagerComponentLoadFailed(MediaProtectionManager sender, ComponentLoadFailedEventArgs e)
 {
     Debug.WriteLine("ProtectionManager ComponentLoadFailed");
     e.Completion.Complete(false);
 }