Ejemplo n.º 1
0
        public void SecureStopProactively()
        {
            Debug.WriteLine("Enter SecureStop.SecureStopReportProactively()");
            try
            {
                Debug.WriteLine("Creating SecureStop report service request...");

                PlayReadySecureStopIterable secureStopIterable = new PlayReadySecureStopIterable(_SecureStopCert);

                PlayReadySecureStopServiceRequest SecureStopRequest = secureStopIterable.First() as PlayReadySecureStopServiceRequest;

                //PlayReadySecureStopServiceRequest SecureStopRequest = new PlayReadySecureStopServiceRequest(_SecureStopCert);
                SecureStopReactively(SecureStopRequest);
            }
            catch (Exception ex)
            {
                if (ex.HResult == ServiceRequest.MSPR_E_NEEDS_INDIVIDUALIZATION)
                {
                    PlayReadyIndividualizationServiceRequest indivServiceRequest = new PlayReadyIndividualizationServiceRequest();

                    RequestChain requestChain = new RequestChain(indivServiceRequest);
                    requestChain.FinishAndReportResult(new ReportResultDelegate(HandleIndivServiceRequest_Finished));
                }
                else
                {
                    Debug.WriteLine("SecureStopProactively failed:" + ex.HResult);
                }
            }

            Debug.WriteLine("Leave SecureStop.SecureStopReportProactively()");
        }
Ejemplo n.º 2
0
        public void  MeteringReportProactively()
        {
            Debug.WriteLine("Enter Metering.MeteringReportProactively()");
            try
            {
                Debug.WriteLine("Creating metering report service request...");
                PlayReadyMeteringReportServiceRequest meteringRequest = new PlayReadyMeteringReportServiceRequest();
                MeteringReportReactively(meteringRequest);
            }
            catch (Exception ex)
            {
                if (ex.HResult == ServiceRequest.MSPR_E_NEEDS_INDIVIDUALIZATION)
                {
                    PlayReadyIndividualizationServiceRequest indivServiceRequest = new PlayReadyIndividualizationServiceRequest();

                    RequestChain requestChain = new RequestChain(indivServiceRequest);
                    requestChain.FinishAndReportResult(new ReportResultDelegate(HandleIndivServiceRequest_Finished));
                }
                else
                {
                    Debug.WriteLine("MeteringReportProactively failed:" + ex.HResult);
                }
            }

            Debug.WriteLine("Leave Metering.MeteringReportProactively()");
        }
Ejemplo n.º 3
0
        public void AcquireLicenseProactively()
        {
            IPlayReadyLicenseAcquisitionServiceRequest licenseRequest;

            try
            {
                PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(0,
                                                                                  RequestConfigData.KeyIds,
                                                                                  null,
                                                                                  RequestConfigData.EncryptionAlgorithm,
                                                                                  null,
                                                                                  null,
                                                                                  String.Empty,
                                                                                  RequestConfigData.DomainServiceId);

                Debug.WriteLine("Creating license acquisition service request...");

                if (bPersistent)
                {
                    // persistent license
                    licenseRequest =
                        (IPlayReadyLicenseAcquisitionServiceRequest) new PlayReadyLicenseAcquisitionServiceRequest();
                }
                else
                {
                    if (this.licenseSession == null)
                    {
                        throw new ArgumentNullException("licenseSession can not be null");
                    }

                    //in-memory license, use license session to create a license service request
                    //this way, the acquired license will be tied to the media session associated with the license session
                    licenseRequest = this.licenseSession.CreateLAServiceRequest();
                }

                licenseRequest.ContentHeader = contentHeader;
                licenseRequest.Uri           = RequestConfigData.Uri;
                AcquireLicenseReactively(licenseRequest);
            }
            catch (Exception ex)
            {
                if (ex.HResult == ServiceRequest.MSPR_E_NEEDS_INDIVIDUALIZATION)
                {
                    PlayReadyIndividualizationServiceRequest indivServiceRequest =
                        new PlayReadyIndividualizationServiceRequest();

                    RequestChain requestChain = new RequestChain(indivServiceRequest);
                    requestChain.FinishAndReportResult(new ReportResultDelegate(HandleIndivServiceRequest_Finished));
                }
                else
                {
                    //Debug.WriteLine("AcquireLicenseProactively failed:" + ex.HResult);
                    Debug.WriteLine("AcquireLicenseProactively failed:" + ex.HResult);
                    licenseRequest =
                        (IPlayReadyLicenseAcquisitionServiceRequest) new PlayReadyLicenseAcquisitionServiceRequest();
                    LAServiceRequestCompleted(licenseRequest, ex);
                }
            }
        }
Ejemplo n.º 4
0
        void ProtectionManager_ServiceRequested(MediaProtectionManager sender, ServiceRequestedEventArgs srEvent)
        {
            Debug.WriteLine("Enter Playback.ProtectionManager_ServiceRequested()");

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

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

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

            Debug.WriteLine("Leave Playback.ProtectionManager_ServiceRequested()");
        }
Ejemplo n.º 5
0
        public void  HandleRevocationProactively()
        {
            try
            {
                PlayReadyRevocationServiceRequest request = new PlayReadyRevocationServiceRequest();
                HandleRevocationReactively(request);
            }
            catch (Exception ex)
            {
                if (ex.HResult == ServiceRequest.MSPR_E_NEEDS_INDIVIDUALIZATION)
                {
                    PlayReadyIndividualizationServiceRequest indivServiceRequest = new PlayReadyIndividualizationServiceRequest();

                    RequestChain requestChain = new RequestChain(indivServiceRequest);
                    requestChain.FinishAndReportResult(new ReportResultDelegate(HandleIndivServiceRequest_Finished));
                }
                else
                {
                    Debug.WriteLine("HandleRevocationProactively failed:" + ex.HResult);
                }
            }
        }
Ejemplo n.º 6
0
        protected bool PerformEnablingActionIfRequested(Exception ex)
        {
            Debug.WriteLine("Enter ServiceRequest.PerformEnablingActionIfRequested()");
            bool bPerformed = false;

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

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

                    bPerformed = true;
                }
            }

            Debug.WriteLine("Leave ServiceRequest.PerformEnablingActionIfRequested()");
            return(bPerformed);
        }