/// 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 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); }
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); }
/// 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; }