Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        void ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs srEvent)
        {
            serviceCompletionNotifier = srEvent.Completion;
            IPlayReadyServiceRequest serviceRequest = (IPlayReadyServiceRequest)srEvent.Request;

            ViewModelBase.Log(serviceRequest.GetType().Name);
            ProcessServiceRequest(serviceRequest);
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
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()");
        }
Ejemplo n.º 5
0
        public void Test_ContentResolver(string strContentHeader, string strExpectServiceRequest, string strRootKid, string strLeafKid)
        {
            TestLogger.LogMessage("Enter Test_ContentResolver()");

            TestLogger.LogMessage("Root Kid = " + strRootKid);
            TestLogger.LogMessage("Leaf Kid = " + strLeafKid);

            bool bTestActionResult     = false;
            bool bExpectServiceRequest = ActionParamConvertToBool(strExpectServiceRequest);

            TestLogger.LogMessage(strContentHeader);
            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(new System.Text.UnicodeEncoding().GetBytes(strContentHeader));

            LicenseAcquisition.DumpContentHeaderValues(contentHeader);

            TestLogger.LogMessage("Using PlayReadyContentResolver...");
            IPlayReadyServiceRequest serviceRequest = PlayReadyContentResolver.ServiceRequest(contentHeader);

            if (serviceRequest == null && !bExpectServiceRequest)
            {
                TestLogger.LogMessage("ServiceRequest not needed!!!");
                bTestActionResult = true;
            }
            else
            {
                TestLogger.LogMessage("Inspecting servicing request...");
                PlayReadyLicenseAcquisitionServiceRequest licenseServiceRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;

                if (licenseServiceRequest == null)
                {
                    TestLogger.LogMessage("!!!!!!!!!!!!!!! servicing request is null !!!!!!!!!!");
                }
                else
                {
                    TestLogger.LogMessage("licenseServiceRequest.ContentHeader.KeyId = " + licenseServiceRequest.ContentHeader.KeyId.ToString());
                    if (licenseServiceRequest.ContentHeader.KeyId == new Guid(strRootKid))
                    {
                        TestLogger.LogMessage("KeyId is equal to expired Root KeyId, as expected");
                        bTestActionResult = true;
                    }
                }
            }

            TestActionFinished(bTestActionResult, null);
            TestLogger.LogMessage("Leave Test_ContentResolver()");
        }
Ejemplo n.º 6
0
        protected bool PerformEnablingActionIfRequested(Exception ex)
        {
            bool bPerformed = false;

            if (IsEnablingActionRequested(ex))
            {
                IPlayReadyServiceRequest nextServiceRequest = _serviceRequest.NextServiceRequest();
                if (nextServiceRequest != null)
                {
                    _requestChain = new RequestChain(nextServiceRequest);
                    _requestChain.LicenseRequestUri = LicenseRequestUri;
                    _requestChain.RequestConfigData = _requestConfigData;
                    _requestChain.FinishAndReportResult(new ReportResultDelegate(RequestChain_Finished));

                    bPerformed = true;
                }
            }

            return(bPerformed);
        }
        private async void MediaProtectionManager_ServiceRequested(Windows.Media.Protection.MediaProtectionManager sender, Windows.Media.Protection.ServiceRequestedEventArgs e)
        {
            var completionNotifier = e.Completion;

            IPlayReadyServiceRequest request = (IPlayReadyServiceRequest)e.Request;

            //TODO: retrieve service request type from Microsoft.Media.Protection.PlayReady
            if (request.Type != new Guid("c6b344bd-6017-4199-8474-694ac3ec0b3f"))
            {
                request.Uri = new Uri(licenseUrl);
            }

            try
            {
                await request.BeginServiceRequest();

                completionNotifier.Complete(true);
            }
            catch (Exception ex)
            {
                completionNotifier.Complete(false);
            }
        }
Ejemplo n.º 8
0
        public void Test_CocktailContentResolver(string strContentHeader, string strLAURL, string strExpectServiceRequest)
        {
            TestLogger.LogMessage("Enter Test_CocktailContentResolver()");

            bool bExpectServiceRequest = ActionParamConvertToBool(strExpectServiceRequest);
            Uri  uri = ActionParamConvertToUri(strLAURL);

            TestLogger.LogMessage(strContentHeader);
            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                new System.Text.UnicodeEncoding().GetBytes(strContentHeader),
                uri,
                uri,
                String.Empty,
                Guid.Empty
                );

            LicenseAcquisition.DumpContentHeaderValues(contentHeader);

            TestLogger.LogMessage("Using PlayReadyContentResolver...");
            IPlayReadyServiceRequest serviceRequest = PlayReadyContentResolver.ServiceRequest(contentHeader);

            if (serviceRequest == null && !bExpectServiceRequest)
            {
                TestLogger.LogMessage("ServiceRequest not needed!!!");
                TestActionFinished(true, null);
            }
            else
            {
                TestLogger.LogMessage("Servicing request...");
                PlayReadyLicenseAcquisitionServiceRequest licenseServiceRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;

                LAAndReportResult licenseAcquisition = new LAAndReportResult(new ReportResultDelegate(TestActionFinished), null);
                licenseAcquisition.AcquireLicenseReactively(serviceRequest as PlayReadyLicenseAcquisitionServiceRequest);
            }

            TestLogger.LogMessage("Leave Test_CocktailContentResolver()");
        }
        protected bool PerformEnablingActionIfRequested(Exception ex)
        {
            TestLogger.LogMessage("Enter ServiceRequest.PerformEnablingActionIfRequested()");
            bool bPerformed = false;

            if (IsEnablingActionRequested(ex))
            {
                TestLogger.LogMessage("!!!NextServiceRequest is needed!!!");
                IPlayReadyServiceRequest nextServiceRequest = _serviceRequest.NextServiceRequest();
                if (nextServiceRequest != null)
                {
                    TestLogger.LogMessage("!!!Servicing next request...");

                    _requestChain = new RequestChain(nextServiceRequest);
                    _requestChain.RequestConfigData = _requestConfigData;
                    _requestChain.FinishAndReportResult(new ReportResultDelegate(RequestChain_Finished));

                    bPerformed = true;
                }
            }

            TestLogger.LogMessage("Leave ServiceRequest.PerformEnablingActionIfRequested()");
            return(bPerformed);
        }
Ejemplo n.º 10
0
 public RequestChain(IPlayReadyServiceRequest serviceRequest)
 {
     _serviceRequest = serviceRequest;
 }
Ejemplo n.º 11
0
 public HttpHelper( IPlayReadyServiceRequest serviceRequest)
 {
     _serviceRequest = serviceRequest;
 }
Ejemplo n.º 12
0
 public RequestChain(IPlayReadyServiceRequest serviceRequest)
 {
     _serviceRequest = serviceRequest;
 }
Ejemplo n.º 13
0
 public HttpHelper(IPlayReadyServiceRequest serviceRequest)
 {
     _serviceRequest = serviceRequest;
 }
Ejemplo n.º 14
0
 public HttpHelper(IPlayReadyServiceRequest serviceRequest, List <KeyValuePair <string, string> > customHeaders = null)
 {
     _serviceRequest    = serviceRequest;
     this.customHeaders = customHeaders;
 }