protected override void LAServiceRequestCompleted(IPlayReadyLicenseAcquisitionServiceRequest sender, Exception hrCompletionStatus) { TestLogger.LogMessage("Enter LAAndReportResult.LAServiceRequestCompleted()"); if (hrCompletionStatus == null) { TestLogger.LogImportantMessage("***License acquisition succeeded***"); _reportResult(true, sampleDataItem); } else { if (PerformEnablingActionIfRequested(hrCompletionStatus) || HandleExpectedError(hrCompletionStatus)) { TestLogger.LogMessage("Exception handled."); } else { TestLogger.LogError("LAServiceRequestCompleted ERROR: " + hrCompletionStatus.ToString()); TestLogger.LogError("hrCompletionStatus.HResult=" + hrCompletionStatus.HResult.ToString()); _reportResult(false, sampleDataItem); } } TestLogger.LogMessage("Leave LAAndReportResult.LAServiceRequestCompleted()"); }
async public void AcquireLicenseReactively(IPlayReadyLicenseAcquisitionServiceRequest licenseRequest) { Debug.WriteLine("Enter LicenseAcquisition.AcquireLicenseReactively()"); Exception exception = null; try { _serviceRequest = licenseRequest; ConfigureServiceRequest(); SerivceRequestStatistics.IncLicenseAcquisitionCount(); Debug.WriteLine("ChallengeCustomData = " + licenseRequest.ChallengeCustomData); if (RequestConfigData.ManualEnabling) { Debug.WriteLine("Manually posting the request..."); HttpHelper httpHelper = new HttpHelper(licenseRequest, customHeaders); await httpHelper.GenerateChallengeAndProcessResponse(); } else { Debug.WriteLine("Begin license acquisition service request..."); await licenseRequest.BeginServiceRequest(); } Debug.WriteLine("Post-LicenseAcquisition Values:"); Debug.WriteLine("DomainServiceId = " + licenseRequest.DomainServiceId.ToString()); DumpContentHeaderValues(licenseRequest.ContentHeader); } catch (Exception ex) { Debug.WriteLine("Saving exception.. " + ex.ToString()); exception = ex; } finally { if (exception == null) { Debug.WriteLine("ResponseCustomData = " + licenseRequest.ResponseCustomData); } LAServiceRequestCompleted(licenseRequest, exception); } Debug.WriteLine("Leave LicenseAcquisition.AcquireLicenseReactively()"); }
/// <summary> /// Reactive license acquisition is triggered by PlayReady when the DRM does not have a license for the /// content(KeyID) as part of an active playback attempt. /// Service requests can be queued which is useful in scenarios such as root/leaf license and PlayReady Domains /// where one license depends on another. The serviceCompletionNotifier is utilized to notify the ProtectionManager /// that the next service request can begin. /// </summary> static async public void ReactiveLicenseAcquisition(IPlayReadyLicenseAcquisitionServiceRequest licenseRequest, MediaProtectionServiceCompletion serviceCompletionNotifier, Action callback = null) { Exception exception = null; bool success = false; try { await licenseRequest.BeginServiceRequest(); success = true; } catch (Exception ex) { exception = ex; } finally { if (serviceCompletionNotifier != null) { // The Complete call will notify listeners that the service call is complete // and queued service requests can begin. serviceCompletionNotifier.Complete(success); serviceCompletionNotifier = null; } ViewModelBase.Log("ReactiveLicenseAcquisition::Complete"); } // optional call back to update UI. if (callback != null) { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { callback.Invoke(); }); } }
protected virtual void LAServiceRequestCompleted(IPlayReadyLicenseAcquisitionServiceRequest sender, Exception hrCompletionStatus) { }
/// <summary> /// Reactive license acquisition is triggered by PlayReady when the DRM does not have a license for the /// content(KeyID) as part of an active playback attempt. /// Service requests can be queued which is useful in scenarios such as root/leaf license and PlayReady Domains /// where one license depends on another. The serviceCompletionNotifier is utilized to notify the ProtectionManager /// that the next service request can begin. /// </summary> static async public void ReactiveLicenseAcquisition(IPlayReadyLicenseAcquisitionServiceRequest licenseRequest, MediaProtectionServiceCompletion serviceCompletionNotifier, Action callback = null) { Exception exception = null; bool success = false; try { await licenseRequest.BeginServiceRequest(); success = true; } catch (Exception ex) { exception = ex; } finally { if (serviceCompletionNotifier != null) { // The Complete call will notify listeners that the service call is complete // and queued service requests can begin. serviceCompletionNotifier.Complete(success); serviceCompletionNotifier = null; } ViewModelBase.Log("ReactiveLicenseAcquisition::Complete"); } // optional call back to update UI. if (callback != null) { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { callback.Invoke(); }); } }