示例#1
0
        /// <summary>
        /// The application can proativly request a license by creating a license request and
        /// assigning a header which provides the specifics such as the KeyId of the license needed.
        /// </summary>
        static public void ProactiveLicenseAcquisition(PlayReadyContentHeader contentHeader, Action callback = null)
        {
            var laRequest = new PlayReadyLicenseAcquisitionServiceRequest();

            laRequest.ContentHeader = contentHeader;
            ReactiveLicenseAcquisition(laRequest, null, callback);
        }
示例#2
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);
                }
            }
        }
        /// A content header is required to make a proactive license request.
        /// The header needs at minimum a KeyId and a License URL.
        /// Additionally you set a custom data property which will be passed in the signed
        /// section of the license request for use by the service.
        void GetLicense(Guid kid)
        {
            var laURL         = new Uri(licenseUrl);
            var customData    = "token:12345";
            var contentHeader = new PlayReadyContentHeader(kid, "", PlayReadyEncryptionAlgorithm.Aes128Ctr, laURL, laURL, customData, Guid.Empty);

            PlayReadyHelpers.ProactiveLicenseAcquisition(contentHeader, () => {
                CmdPlayMovie.RaiseCanExecuteChanged();
                CmdStopMovie.RaiseCanExecuteChanged();
            });
        }
 public void  AcquireLicenseProactively()
 {
     PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                                                                         RequestConfigData.KeyId,
                                                                         RequestConfigData.KeyIdString,
                                                                         RequestConfigData.EncryptionAlgorithm,
                                                                         RequestConfigData.Uri,
                                                                         RequestConfigData.Uri,
                                                                         String.Empty, 
                                                                         RequestConfigData.DomainServiceId);
     
     PlayReadyLicenseAcquisitionServiceRequest licenseRequest = new PlayReadyLicenseAcquisitionServiceRequest();
     licenseRequest.ContentHeader = contentHeader;
     AcquireLicenseReactively( licenseRequest );
     
 }
        public void  AcquireLicenseProactively()
        {
            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                RequestConfigData.KeyId,
                RequestConfigData.KeyIdString,
                RequestConfigData.EncryptionAlgorithm,
                RequestConfigData.Uri,
                RequestConfigData.Uri,
                String.Empty,
                RequestConfigData.DomainServiceId);

            PlayReadyLicenseAcquisitionServiceRequest licenseRequest = new PlayReadyLicenseAcquisitionServiceRequest();

            licenseRequest.ContentHeader = contentHeader;
            AcquireLicenseReactively(licenseRequest);
        }
示例#6
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()");
        }
示例#7
0
        /// <summary>
        /// ...
        /// </summary>
        void ProcessServiceRequest(IMediaProtectionServiceRequest serviceRequest)
        {
            //Alternatively the serviceRequest can be determined by the Guid serviceRequest.Type
            if (serviceRequest is PlayReadyIndividualizationServiceRequest)
            {
                PlayReadyHelpers.ReactiveIndividualization(serviceRequest as PlayReadyIndividualizationServiceRequest, serviceCompletionNotifier, () => PlayReadyInfo.RefreshStatics());
                PlayReadyInfo.RefreshStatics();
            }
            else if (serviceRequest is PlayReadyLicenseAcquisitionServiceRequest)
            {
                var licenseServiceRequestNotUsed = (serviceRequest as PlayReadyLicenseAcquisitionServiceRequest);
                activePlayReadyHeader = licenseServiceRequestNotUsed.ContentHeader;

                var licenseServiceRequest = licenseSession.CreateLAServiceRequest();
                licenseServiceRequest.ContentHeader = activePlayReadyHeader;
                licenseServiceRequest.Uri           = new Uri(licenseUrl);
                PlayReadyHelpers.ReactiveLicenseAcquisition(licenseServiceRequest, serviceCompletionNotifier);
            }
        }
        static public async Task DeleteLicenses(Guid keyId, string keyIdString, PlayReadyEncryptionAlgorithm algorithm)
        {
            TestLogger.LogMessage("Enter LicenseManagement.DeleteLicenses()");
            TestLogger.LogMessage("PlayReadyEncryptionType = " + algorithm.ToString());

            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                keyId,
                keyIdString,
                algorithm,
                null,
                null,
                String.Empty,
                Guid.Empty);

            TestLogger.LogMessage("Deleting licenses...");
            await PlayReadyLicenseManagement.DeleteLicenses(contentHeader);

            TestLogger.LogMessage("Leave LicenseManagement.DeleteLicenses()");
        }
        /// Tests to see if a license is available for playback.
        bool IsLicenseAvailable(Guid kid)
        {
            // return false is app is not initialized
            // creating a PlayReadyContentHeader in an un-initialized app
            // will cause an exception
            if (!PlayReadyHelpers.IsIndividualized)
            {
                return(false);
            }
            var contentHeader = new PlayReadyContentHeader(kid, "", PlayReadyEncryptionAlgorithm.Aes128Ctr, new Uri(licenseUrl), new Uri(licenseUrl), "", Guid.Empty);
            var licenses      = new PlayReadyLicenseIterable(contentHeader, false);

            foreach (var license in licenses)
            {
                if (license.UsableForPlay)
                {
                    return(true);
                }
            }

            return(false);
        }
        static public void DumpContentHeaderValues(PlayReadyContentHeader contentHeader)
        {
            TestLogger.LogMessage(" ");
            TestLogger.LogImportantMessage("Content header values:");
            if (contentHeader == null)
            {
                return;
            }
            TestLogger.LogMessage("CustomAttributes :" + contentHeader.CustomAttributes);
            TestLogger.LogMessage("DecryptorSetup   :" + contentHeader.DecryptorSetup.ToString());
            TestLogger.LogMessage("DomainServiceId  :" + contentHeader.DomainServiceId.ToString());
            TestLogger.LogMessage("EncryptionType   :" + contentHeader.EncryptionType.ToString());
            for (int i = 0; i < contentHeader.KeyIds.Length; i++)
            {
                TestLogger.LogImportantMessage("KeyId " + i + "       :" + contentHeader.KeyIds[i].ToString());
                TestLogger.LogImportantMessage("KeyIdString " + i + " :" + contentHeader.KeyIdStrings[i]);
            }

            if (contentHeader.LicenseAcquisitionUrl != null)
            {
                TestLogger.LogImportantMessage("LicenseAcquisitionUrl :" + contentHeader.LicenseAcquisitionUrl.ToString());
            }
        }
示例#11
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()");
        }
示例#12
0
        static public PlayReadyLicense FindSingleLicense(Guid keyId, string keyIdString, bool bFullyEvaluated)
        {
            Debug.WriteLine("Enter LicenseManagement.FindSingleLicense()");

            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                keyId,
                keyIdString,
                PlayReadyEncryptionAlgorithm.Aes128Ctr,
                null,
                null,
                String.Empty,
                Guid.Empty);

            Debug.WriteLine("Creating PlayReadyLicenseIterable...");
            PlayReadyLicenseIterable licenseIterable = new PlayReadyLicenseIterable(contentHeader, bFullyEvaluated);

            foreach (PlayReadyLicense lic in licenseIterable)
            {
                DumpLicenseValues(lic);
            }

            PlayReadyLicense license = null;
            IEnumerable <IPlayReadyLicense> licenseEnumerable = licenseIterable;

            int licenseCount = Enumerable.Count <IPlayReadyLicense>(licenseEnumerable);

            Debug.WriteLine("License count  :" + licenseCount);
            if (licenseCount > 0)
            {
                license = Enumerable.ElementAt <IPlayReadyLicense>(licenseEnumerable, 0) as PlayReadyLicense;
            }

            Debug.WriteLine("Leave LicenseManagement.FindSingleLicense()");

            return(license);
        }
        static public IPlayReadyLicense[] FindMultipleLicenses(Guid keyId, string keyIdString, bool bFullyEvaluated)
        {
            TestLogger.LogMessage("Enter LicenseManagement.FindMultipleLicenses()");

            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                keyId,
                keyIdString,
                PlayReadyEncryptionAlgorithm.Aes128Ctr,
                null,
                null,
                String.Empty,
                Guid.Empty);

            TestLogger.LogMessage("Creating PlayReadyLicenseIterable...");
            PlayReadyLicenseIterable licenseIterable = new PlayReadyLicenseIterable(contentHeader, bFullyEvaluated);

            foreach (PlayReadyLicense lic in licenseIterable)
            {
                DumpLicenseValues(lic);
            }

            IPlayReadyLicense[]             licenses          = null;
            IEnumerable <IPlayReadyLicense> licenseEnumerable = licenseIterable;

            int licenseCount = Enumerable.Count <IPlayReadyLicense>(licenseEnumerable);

            TestLogger.LogMessage("License count  :" + licenseCount);
            if (licenseCount > 0)
            {
                licenses = Enumerable.ToArray <IPlayReadyLicense>(licenseEnumerable);
            }

            TestLogger.LogMessage("Leave LicenseManagement.FindMultipleLicenses()");

            return(licenses);
        }
        /// Tests to see if a license is available for playback.
        bool IsLicenseAvailable(Guid kid)
        {
            // return false is app is not initialized 
            // creating a PlayReadyContentHeader in an un-initialized app
            // will cause an exception
            if (!PlayReadyHelpers.IsIndividualized)
            {
                return false;
            }
            var contentHeader = new PlayReadyContentHeader(kid, "", PlayReadyEncryptionAlgorithm.Aes128Ctr, new Uri(licenseUrl), new Uri(licenseUrl), "", Guid.Empty);
            var licenses = new PlayReadyLicenseIterable(contentHeader, false);
            foreach (var license in licenses)
            {
                if (license.UsableForPlay)
                {
                    return true;
                }
            }

            return false;
        }
 /// A content header is required to make a proactive license request.
 /// The header needs at minimum a KeyId and a License URL.
 /// Additionally you set a custom data property which will be passed in the signed
 /// section of the license request for use by the service.
 void GetLicense(Guid kid)
 {
     var laURL = new Uri(licenseUrl);
     var customData = "token:12345";
     var contentHeader =  new PlayReadyContentHeader(kid, "", PlayReadyEncryptionAlgorithm.Aes128Ctr, laURL, laURL, customData, Guid.Empty);
     PlayReadyHelpers.ProactiveLicenseAcquisition(contentHeader, () => {
         CmdPlayMovie.RaiseCanExecuteChanged();
         CmdStopMovie.RaiseCanExecuteChanged();
     });
 }
        /// <summary>
        /// A view model class for the IndivReactive Scenario.
        /// </summary>
        public SecureStopViewModel(MediaElement mediaElement)
        {
            this.ProtectionManager = PlayReadyHelpers.InitializeProtectionManager(ServiceRequested);
            mediaElement.ProtectionManager = this.ProtectionManager;

            licenseSession = PlayReadyHelpers.createLicenseSession();
            licenseSession.ConfigureMediaProtectionManager(mediaElement.ProtectionManager);

            PlayReadyInfo = new PlayReadyInfoViewModel();
            PlayReadyInfo.RefreshStatics();

            CmdPlayMovie = new RelayCommand(
                                    () => { mediaElement.Source = new Uri(moviePath); SetPlaybackEnabled(true); },
                                    () => publisherCert != null);

            CmdStopMovie = new RelayCommand(() => { mediaElement.Stop();}, 
                                            () => publisherCert != null);

            CmdGetPublisherCert = new RelayCommand(() => 
                                            {
                                                GetPublisherCert(publisherID, (cert) =>
                                                {
                                                    CmdPlayMovie.RaiseCanExecuteChanged();
                                                    CmdStopMovie.RaiseCanExecuteChanged();
                                                    CmdRenewLicense.RaiseCanExecuteChanged();
                                                });
                                            });

            CmdRenewLicense = new RelayCommand(() => RenewActiveLicense(), 
                                               () => publisherCert != null);

            mediaElement.CurrentStateChanged += (s, a) =>
            {
                ViewModelBase.Log("Media State::" + mediaElement.CurrentState);

                switch (mediaElement.CurrentState)
                {
                    case MediaElementState.Closed:
                        SendSecureStopRecords();
                        activePlayReadyHeader = null;
                        SetPlaybackEnabled(false);
                        // renewing the licenseSession for subsequent Plays since the 
                        // session is stopped
                        licenseSession = PlayReadyHelpers.createLicenseSession();
                        licenseSession.ConfigureMediaProtectionManager(mediaElement.ProtectionManager);
                        break;
                    default:
                        break;
                }

            };

            mediaElement.MediaFailed += (s, a) =>
            {
                ViewModelBase.Log("Err::" + a.ErrorMessage);
            };

            var localSettings = ApplicationData.Current.LocalSettings;
            ApplicationDataContainer container;
            localSettings.Containers.TryGetValue("PublisherCerts", out container);
            if (container != null && container.Values.ContainsKey(publisherID))
            {
                publisherCert = (byte[])container.Values[publisherID];
            }

            try
            {
                var securityVersion = PlayReadyStatics.PlayReadySecurityVersion;
                SendSecureStopRecords();
            }
            catch {
                PlayReadyHelpers.ProactiveIndividualization(() =>
                {
                    PlayReadyInfo.RefreshStatics();
                });
            }
        }
示例#17
0
        public async void Test_HeaderWithEmbeddedUpdates(string strKeyId,
                                                         string strEncryptionAlgorithm,
                                                         string strLAURL,
                                                         string strServiceID,
                                                         string strExpectFailure)
        {
            TestLogger.LogMessage(" ");
            TestLogger.LogMessage("Enter Test_HeaderWithEmbeddedUpdates()");
            bool bActionSucceeded = false;

            Guid keyIdGuid     = ActionParamConvertToGuid(strKeyId);
            Uri  uriLA         = ActionParamConvertToUri(strLAURL);
            Guid guidServiceId = ActionParamConvertToGuid(strServiceID);

            PlayReadyEncryptionAlgorithm encryptionAlgorithm = ActionParamConvertToPlayReadyEncryptionAlgorithm(strEncryptionAlgorithm);

            TestLogger.LogMessage("Creating PlayReadyContentHeader..");
            PlayReadyContentHeader contentHeader = new PlayReadyContentHeader(
                keyIdGuid,
                string.Empty,
                encryptionAlgorithm,
                uriLA,
                uriLA,
                String.Empty,
                guidServiceId);

            TestLogger.LogMessage("Getting HeaderWithEmbeddedUpdates..");
            PlayReadyContentHeader contentHeaderWithEmbeddedUpdates = contentHeader.HeaderWithEmbeddedUpdates;

            if (contentHeaderWithEmbeddedUpdates == null)
            {
                TestLogger.LogMessage("HeaderWithEmbeddedUpdates not available");
                if (strExpectFailure.ToLower() == "true")
                {
                    bActionSucceeded = true;
                }
            }
            else
            {
                byte[] headerBytes = contentHeaderWithEmbeddedUpdates.GetSerializedHeader();

                TestLogger.LogMessage("HeaderWithEmbeddedUpdates:");

                Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
                StorageFile HeaderWithEmbeddedLicenseFile = await localFolder.CreateFileAsync("HeaderWithEmbeddedLicense.bin",
                                                                                              CreationCollisionOption.ReplaceExisting);

                await FileIO.WriteBytesAsync(HeaderWithEmbeddedLicenseFile, headerBytes);

                string strHeader = Encoding.UTF8.GetString(headerBytes, 0, headerBytes.Length);

                if (strHeader.Contains("EST") && strHeader.Contains("XMR"))
                {
                    TestLogger.LogMessage("Header contains EST and XMR");
                    bActionSucceeded = true;
                }
                else
                {
                    TestLogger.LogMessage("Header doesn't contains EST and XMR");
                }
            }

            TestActionFinished(bActionSucceeded, null);
            TestLogger.LogMessage("Leave Test_HeaderWithEmbeddedUpdates()");
        }
 /// <summary>
 /// The application can proativly request a license by creating a license request and 
 /// assigning a header which provides the specifics such as the KeyId of the license needed.
 /// </summary>
 static public void ProactiveLicenseAcquisition(PlayReadyContentHeader contentHeader, Action callback = null)
 {
     var laRequest = new PlayReadyLicenseAcquisitionServiceRequest();
     laRequest.ContentHeader = contentHeader;
     ReactiveLicenseAcquisition(laRequest, null, callback);
 }
示例#19
0
        /// <summary>
        /// A view model class for the IndivReactive Scenario.
        /// </summary>
        public SecureStopViewModel(MediaElement mediaElement)
        {
            this.ProtectionManager         = PlayReadyHelpers.InitializeProtectionManager(ServiceRequested);
            mediaElement.ProtectionManager = this.ProtectionManager;

            licenseSession = PlayReadyHelpers.createLicenseSession();
            licenseSession.ConfigureMediaProtectionManager(mediaElement.ProtectionManager);

            PlayReadyInfo = new PlayReadyInfoViewModel();
            PlayReadyInfo.RefreshStatics();

            CmdPlayMovie = new RelayCommand(
                () => { mediaElement.Source = new Uri(moviePath); SetPlaybackEnabled(true); },
                () => publisherCert != null);

            CmdStopMovie = new RelayCommand(() => { mediaElement.Stop(); },
                                            () => publisherCert != null);

            CmdGetPublisherCert = new RelayCommand(() =>
            {
                GetPublisherCert(publisherID, (cert) =>
                {
                    CmdPlayMovie.RaiseCanExecuteChanged();
                    CmdStopMovie.RaiseCanExecuteChanged();
                    CmdRenewLicense.RaiseCanExecuteChanged();
                });
            });

            CmdRenewLicense = new RelayCommand(() => RenewActiveLicense(),
                                               () => publisherCert != null);

            mediaElement.CurrentStateChanged += (s, a) =>
            {
                ViewModelBase.Log("Media State::" + mediaElement.CurrentState);

                switch (mediaElement.CurrentState)
                {
                case MediaElementState.Closed:
                    SendSecureStopRecords();
                    activePlayReadyHeader = null;
                    SetPlaybackEnabled(false);
                    // renewing the licenseSession for subsequent Plays since the
                    // session is stopped
                    licenseSession = PlayReadyHelpers.createLicenseSession();
                    licenseSession.ConfigureMediaProtectionManager(mediaElement.ProtectionManager);
                    break;

                default:
                    break;
                }
            };

            mediaElement.MediaFailed += (s, a) =>
            {
                ViewModelBase.Log("Err::" + a.ErrorMessage);
            };

            var localSettings = ApplicationData.Current.LocalSettings;
            ApplicationDataContainer container;

            localSettings.Containers.TryGetValue("PublisherCerts", out container);
            if (container != null && container.Values.ContainsKey(publisherID))
            {
                publisherCert = (byte[])container.Values[publisherID];
            }

            try
            {
                var securityVersion = PlayReadyStatics.PlayReadySecurityVersion;
                SendSecureStopRecords();
            }
            catch {
                PlayReadyHelpers.ProactiveIndividualization(() =>
                {
                    PlayReadyInfo.RefreshStatics();
                });
            }
        }
        /// <summary>
        /// ...
        /// </summary>
        void ProcessServiceRequest(IMediaProtectionServiceRequest serviceRequest)
        {
            //Alternatively the serviceRequest can be determined by the Guid serviceRequest.Type
            if (serviceRequest is PlayReadyIndividualizationServiceRequest)
            {
                PlayReadyHelpers.ReactiveIndividualization(serviceRequest as PlayReadyIndividualizationServiceRequest, serviceCompletionNotifier, () => PlayReadyInfo.RefreshStatics());
                PlayReadyInfo.RefreshStatics();
            }
            else if (serviceRequest is PlayReadyLicenseAcquisitionServiceRequest)
            {
                var licenseServiceRequestNotUsed = (serviceRequest as PlayReadyLicenseAcquisitionServiceRequest);
                activePlayReadyHeader = licenseServiceRequestNotUsed.ContentHeader;

                var licenseServiceRequest = licenseSession.CreateLAServiceRequest();
                licenseServiceRequest.ContentHeader = activePlayReadyHeader;
                licenseServiceRequest.Uri = new Uri(licenseUrl);
                PlayReadyHelpers.ReactiveLicenseAcquisition(licenseServiceRequest, serviceCompletionNotifier);
            }
        }