public void Test_LicenseAcquisition(Guid [] GuidKids, string strEncryptionAlgorithm, string strLAURL, string strServiceID, string strCustomData, string useManualEnabling, string errorExpected) { TestLogger.LogMessage("Enter Test_LicenseAcquisition()"); ServiceRequestConfigData requestConfigData = new ServiceRequestConfigData(); requestConfigData.KeyIds = GuidKids; requestConfigData.EncryptionAlgorithm = ActionParamConvertToPlayReadyEncryptionAlgorithm(strEncryptionAlgorithm); requestConfigData.Uri = ActionParamConvertToUri(strLAURL); requestConfigData.DomainServiceId = ActionParamConvertToGuid(strServiceID); requestConfigData.ChallengeCustomData = ActionParamConvertToString(strCustomData); if (useManualEnabling.ToLower() == "true") { requestConfigData.ManualEnabling = true; } _licenseAcquisition = new LAAndReportResult(new ReportResultDelegate(TestActionFinished)); _licenseAcquisition.RequestConfigData = requestConfigData; _licenseAcquisition.ExpectedError = ActionParamConvertToString(errorExpected); _licenseAcquisition.AcquireLicenseProactively(); TestLogger.LogMessage("Leave Test_LicenseAcquisition()"); }
private void ProactiveLA(LAAndReportResult f_licenseAcquisition, SampleDataItem f_item, Playback f_playMedia, String f_Laurl, bool f_useFirstPlayExpiration, bool f_rootLicense) { PRUtilities prUtilities = new PRUtilities(); String laurl = f_Laurl; ServiceRequestConfigData LArequestConfigData = new ServiceRequestConfigData(); if (f_rootLicense && f_item.UplinkKey != "null") //pre-acquire a root license { Guid[] GuidRootKids = new Guid[1]; GuidRootKids[0] = prUtilities.ActionParamConvertToGuid(f_item.UplinkKey); LArequestConfigData.KeyIds = GuidRootKids; //chained Root License laurl = laurl + "&UseRootLicense=1"; } else if (!(f_item.Kid.ToString().Equals("null"))) //if kids is not null, proactively acquire simple or leaf license { if (f_item.UplinkKey != "null") { //chained Leaf License Guid uplinkKeyGUID = prUtilities.ActionParamConvertToGuid(f_item.UplinkKey); LogMessage("uplinkKeyGUID=" + uplinkKeyGUID); string base64UplinkKid = prUtilities.GuidToBase64(uplinkKeyGUID); LogMessage("base64UplinkKid=" + base64UplinkKid); { laurl = laurl + "&UseChainLicense=1" + "&UplinkKey=" + base64UplinkKid; } } int count = 100; int i = 0; Guid[] guidKids; string[] keyIds = f_item.Kid.Split(','); int len = keyIds.Length; if (f_useFirstPlayExpiration && f_item.FirstPlayExpiration != "null") //realtime expiration { laurl = laurl + "&RealTimeExpiration=1" + "&FirstPlayExpiration=" + f_item.FirstPlayExpiration; guidKids = new Guid[count]; for (; i < count / 2; i++) { guidKids[i] = Guid.NewGuid(); } for (int j = 0; j < len; j++) { guidKids[i++] = prUtilities.ActionParamConvertToGuid(keyIds[j]); } for (; i < count; i++) { guidKids[i] = Guid.NewGuid(); } } else { guidKids = new Guid[len]; for (int j = 0; j < len; j++) { guidKids[j] = prUtilities.ActionParamConvertToGuid(keyIds[j]); } } LArequestConfigData.KeyIds = guidKids; } LArequestConfigData.EncryptionAlgorithm = prUtilities.ActionParamConvertToPlayReadyEncryptionAlgorithm(f_item.EncryptionAlgorithm); LArequestConfigData.Uri = prUtilities.ActionParamConvertToUri(laurl); LArequestConfigData.DomainServiceId = prUtilities.ActionParamConvertToGuid(f_item.DomainId); LArequestConfigData.ChallengeCustomData = prUtilities.ActionParamConvertToString(f_item.CustomData); f_licenseAcquisition.RequestConfigData = LArequestConfigData; if (f_Laurl.Contains("UseSimpleNonPersistentLicense=1")) { //To acquire in memory license proactively that will later be used for playback, we need to create the media session before hand. //Afterward, we need to tie the license session to the playback session. See configMediaProtectionManager for more detail. f_licenseAcquisition.Persistent = false; f_licenseAcquisition.configMediaProtectionManager(f_playMedia.mediaProtectionManager); } else { f_licenseAcquisition.Persistent = true; } f_licenseAcquisition.AcquireLicenseProactively(); }