virtual protected void MediaFailed(object sender, ExceptionRoutedEventArgs e) { UnhookEventHandlers(); TestLogger.LogMessage("MediaFailed Source: " + ((MediaElement)sender).Source); TestLogger.LogMessage("Playback Failed"); TestLogger.LogMessage("MediaFailed: " + e.ErrorMessage); }
public void SetMediaSource(string strMediaPath, bool bPlayToEnd) { TestLogger.LogMessage("Enter Playback.SetMediaSource()"); if (_mediaElement == null) { TestLogger.LogMessage("_mediaElement is closed "); return; } _bplayToEnd = bPlayToEnd; _strMediaPath = strMediaPath; // // In order to play Smooth Streaming content (e.g. PIFF_SuperSpeedway_720.ism at // http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism/Manifest) // you need to add Microsoft Universal Smooth Streaming Client SDK to the project's References. // If you haven't installed the SDK, you can download and install the SDK from // https://visualstudiogallery.msdn.microsoft.com/1e7d4700-7fa8-49b6-8a7b-8d8666685459?SRC=Home. // Also add Visual C++ 2015 Runtime for Universal Windows Platform Apps to the project's References // if it hasn't been added. // HookEventHandlers(); _mediaElement.Source = new Uri(_strMediaPath); TestLogger.LogMessage("Leave Playback.SetMediaSource()"); }
public void Test_VerifyMultipleLicenses(string strKeyId, string strKeyIdString, string strEvaluated, string strShouldExist, string strCount) { TestLogger.LogMessage("Enter Test_VerifyMultipleLicenses()"); Guid keyIdGuid = ActionParamConvertToGuid(strKeyId); string keyIdString = ActionParamConvertToString(strKeyIdString); bool bFullyEvaluated = ActionParamConvertToBool(strEvaluated); bool bLicenseShouldExist = ActionParamConvertToBool(strShouldExist); Nullable <uint> uintCount = ActionParamConvertToUint(strCount); if (bLicenseShouldExist) { VerifyLicensesShouldExist(keyIdGuid, bFullyEvaluated, uintCount); } else { VerifyLicensesShouldNotExist(keyIdGuid, bFullyEvaluated); } TestLogger.LogMessage("Leave Test_VerifyMultipleLicenses()"); }
static public PlayReadyDomain FindSingleDomain(Guid guidAccountId) { TestLogger.LogMessage("Enter DomainManagement.FindSingleDomain()"); TestLogger.LogMessage("Creating PlayReadyDomainIterable..."); PlayReadyDomainIterable domainIterable = new PlayReadyDomainIterable(guidAccountId); foreach (PlayReadyDomain dom in domainIterable) { DumpDomainValues(dom); } PlayReadyDomain domain = null; IEnumerable <IPlayReadyDomain> domainEnumerable = domainIterable; int domainCount = Enumerable.Count <IPlayReadyDomain>(domainEnumerable); TestLogger.LogMessage("domain count :" + domainCount); if (domainCount > 0) { domain = Enumerable.ElementAt <IPlayReadyDomain>(domainEnumerable, 0) as PlayReadyDomain; } TestLogger.LogMessage("Leave DomainManagement.FindSingleDomain()"); return(domain); }
static public IPlayReadyDomain[] FindMultipleDomains(Guid guidAccountId) { TestLogger.LogMessage("Enter DomainManagement.FindMultipleDomains()"); TestLogger.LogMessage("Creating PlayReadyDomainIterable..."); PlayReadyDomainIterable domainIterable = new PlayReadyDomainIterable(guidAccountId); foreach (PlayReadyDomain dom in domainIterable) { DumpDomainValues(dom); } IPlayReadyDomain[] domains = null; IEnumerable <IPlayReadyDomain> domainEnumerable = domainIterable; int domainCount = Enumerable.Count <IPlayReadyDomain>(domainEnumerable); TestLogger.LogMessage("domain count :" + domainCount); if (domainCount > 0) { domains = Enumerable.ToArray <IPlayReadyDomain>(domainEnumerable); } TestLogger.LogMessage("Leave DomainManagement.FindMultipleDomains()"); return(domains); }
public async void Test_DeleteLicenses(string strKeyId, string strEncryptionType, string strExpectedError) { TestLogger.LogMessage("Enter Test_DeleteLicenses()"); strExpectedError = ActionParamConvertToString(strExpectedError); bool bTestActionResult = true; try { Guid keyIdGuid = ActionParamConvertToGuid(strKeyId); PlayReadyEncryptionAlgorithm alg = ActionParamConvertToPlayReadyEncryptionAlgorithm(strEncryptionType); await LicenseManagement.DeleteLicenses(keyIdGuid, string.Empty, alg); } catch (Exception ex) { TestLogger.LogMessage("Test_DeleteLicenses Exception = " + ex.Message); if (strExpectedError != null && ex.Message.ToLower().Contains(strExpectedError.ToLower())) { TestLogger.LogMessage("'" + ex.Message + "' Contains " + strExpectedError + " as expected"); bTestActionResult = true; } else { bTestActionResult = false; } } TestLogger.LogMessage("Leave Test_DeleteLicenses()"); TestActionFinished(bTestActionResult, null); }
public void Test_VerifyLicense(string keyId, string keyIdString, string evaluated, string shouldExist ) { TestLogger.LogMessage("Enter Test_VerifyLicense()"); Guid keyIdGuid = ActionParamConvertToGuid(keyId); keyIdString = ActionParamConvertToString(keyIdString); bool bFullyEvaluated = ActionParamConvertToBool(evaluated); bool bLicenseShouldExist = ActionParamConvertToBool(shouldExist); if (bLicenseShouldExist) { VerifyLicenseShouldExist(keyIdGuid, keyIdString, bFullyEvaluated); } else { VerifyLicenseShouldNotExist(keyIdGuid, keyIdString, bFullyEvaluated); } TestLogger.LogMessage("Leave Test_VerifyLicense()"); }
static public void DumpLicenseValues(PlayReadyLicense license) { TestLogger.LogMessage(" "); TestLogger.LogMessage("License values:"); TestLogger.LogMessage("FullyEvaluated :" + license.FullyEvaluated.ToString()); TestLogger.LogMessage("UsableForPlay :" + license.UsableForPlay.ToString()); if (license.ExpirationDate == null) { TestLogger.LogMessage("Expiration date : Not specified"); } else { TestLogger.LogMessage("Expiration date :" + license.ExpirationDate.ToString()); } TestLogger.LogMessage("Expiration period after first play :" + license.ExpireAfterFirstPlay); TestLogger.LogMessage("DomainAccountId :" + license.DomainAccountID.ToString()); TestLogger.LogMessage("ChainDepth :" + license.ChainDepth); for (uint i = 0; i < license.ChainDepth; i++) { Guid keyId = license.GetKIDAtChainDepth(i); TestLogger.LogMessage(String.Format(System.Globalization.CultureInfo.CurrentCulture, "KeyId at chain depth ( {0} ) : {1}", i, keyId.ToString())); } TestLogger.LogMessage(" "); }
public void Test_PlayExpectLAFailure(MediaElement mediaElement, string mediaName, string strLAURL, string strCustomData, string strExpectedLAErrorCode, string strExpectedPlaybackErrorCode, string useManualEnabling ) { TestLogger.LogMessage("Enter Test_PlayExpectLAFailure()"); ServiceRequestConfigData requestConfigData = new ServiceRequestConfigData(); requestConfigData.Uri = ActionParamConvertToUri(strLAURL); requestConfigData.ChallengeCustomData = ActionParamConvertToString(strCustomData); requestConfigData.ExpectedLAErrorCode = ActionParamConvertToString(strExpectedLAErrorCode); requestConfigData.ManualEnabling = ActionParamConvertToBool(useManualEnabling); _playbackAndReportResult = new PlaybackAndReportResult( mediaElement, new ReportResultDelegate(TestActionFinished), ActionParamConvertToString(strExpectedPlaybackErrorCode) ); _playbackAndReportResult.RequestConfigData = requestConfigData; _playbackAndReportResult.FullPlayback(mediaElement, mediaName); TestLogger.LogMessage("Leave Test_PlayExpectLAFailure()"); }
public void Test_PlayWithExpectedError(MediaElement mediaElement, string mediaName, string strLAURL, string strCustomData, string strServiceId, string strAccountId, string strExpectedError) { TestLogger.LogMessage("Enter Test_PlayWithExpectedError()"); ServiceRequestConfigData requestConfigData = new ServiceRequestConfigData(); requestConfigData.Uri = ActionParamConvertToUri(strLAURL); requestConfigData.ChallengeCustomData = ActionParamConvertToString(strCustomData); requestConfigData.DomainUri = requestConfigData.Uri; requestConfigData.DomainServiceId = ActionParamConvertToGuid(strServiceId); requestConfigData.DomainAccountId = ActionParamConvertToGuid(strAccountId); _playbackAndReportResult = new PlaybackAndReportResult( mediaElement, new ReportResultDelegate(TestActionFinished), ActionParamConvertToString(strExpectedError) ); _playbackAndReportResult.RequestConfigData = requestConfigData; _playbackAndReportResult.FullPlayback(mediaElement, mediaName); TestLogger.LogMessage("Leave Test_PlayWithExpectedError()"); }
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()"); }
public void Test_LoadMedia(MediaElement mediaElement, string mediaName, string strLAURL, string strCustomData, string strDJURL, string strServiceId, string strAccountId, string useManualEnabling) { TestLogger.LogMessage("Enter Test_LoadMedia()"); ServiceRequestConfigData requestConfigData = new ServiceRequestConfigData(); requestConfigData.Uri = ActionParamConvertToUri(strLAURL); requestConfigData.ChallengeCustomData = ActionParamConvertToString(strCustomData); requestConfigData.DomainUri = ActionParamConvertToUri(strDJURL); requestConfigData.DomainServiceId = ActionParamConvertToGuid(strServiceId); requestConfigData.DomainAccountId = ActionParamConvertToGuid(strAccountId); requestConfigData.ManualEnabling = ActionParamConvertToBool(useManualEnabling); _playbackAndReportResult = new PlaybackAndReportResult(mediaElement, new ReportResultDelegate(TestActionFinished)); _playbackAndReportResult.RequestConfigData = requestConfigData; _playbackAndReportResult.LoadMedia(mediaElement, mediaName, false); TestLogger.LogMessage("Leave Test_LoadMedia()"); }
public void Test_VerifyServiceRequestStatistics(string strIndivCount, string strLACount) { TestLogger.LogMessage("Enter Test_VerifyServiceRequestStatistics()"); uint?indivCount = ActionParamConvertToUint(strIndivCount); uint?LACount = ActionParamConvertToUint(strLACount); bool bTestActionResult = true; if (indivCount.HasValue) { uint actualIndivCount = SerivceRequestStatistics.GetIndivCount(); TestLogger.LogMessage("Actual indiv count = " + actualIndivCount); if (indivCount.Value != actualIndivCount) { bTestActionResult = false; } } if (LACount.HasValue) { uint ActualLicenseAcquisitionCount = SerivceRequestStatistics.GetLicenseAcquisitionCount(); TestLogger.LogMessage("Actual license acquisition count = " + ActualLicenseAcquisitionCount); if (LACount.Value != ActualLicenseAcquisitionCount) { bTestActionResult = false; } } TestActionFinished(bTestActionResult, null); TestLogger.LogMessage("Leave Test_VerifyServiceRequestStatistics()"); }
public async void IndivReactively(PlayReadyIndividualizationServiceRequest indivRequest) { TestLogger.LogMessage("Enter Indiv.IndivReactively()"); Exception exception = null; try { _serviceRequest = indivRequest; SerivceRequestStatistics.IncIndivCount(); TestLogger.LogMessage("Begin indiv service request..."); await indivRequest.BeginServiceRequest(); } catch (Exception ex) { TestLogger.LogMessage("Saving exception.."); exception = ex; } finally { IndivServiceRequestCompleted(indivRequest, exception); } TestLogger.LogMessage("Leave Indiv.IndivReactively()"); }
void DumpPlayReadySettings() { TestLogger.LogMessage("Dumping PlayReadySettings..."); Windows.Storage.ApplicationData appData = Windows.Storage.ApplicationData.Current; Windows.Storage.StorageFolder storageFolder = appData.LocalFolder; TestLogger.LogMessage("AppData LocalFolder Path = " + storageFolder.Path); IReadOnlyDictionary <string, ApplicationDataContainer> dictionary = appData.LocalSettings.Containers; TestLogger.LogMessage("Container count = " + dictionary.Count); foreach (string containerName in dictionary.Keys) { TestLogger.LogMessage("Container name = " + containerName); } Windows.Storage.ApplicationDataContainer playreadySettings = appData.LocalSettings.Containers["PlayReady"]; TestLogger.LogMessage("Settings container Name = " + playreadySettings.Name); Windows.Foundation.Collections.IPropertySet propertySetValues = playreadySettings.Values; foreach (string strKey in propertySetValues.Keys) { string strValue = propertySetValues[strKey].ToString(); TestLogger.LogMessage("Key = " + strKey); TestLogger.LogMessage("Value = " + strValue); } }
public void MeteringReportProactively() { TestLogger.LogMessage("Enter Metering.MeteringReportProactively()"); try { TestLogger.LogMessage("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 { TestLogger.LogImportantMessage("MeteringReportProactively failed:" + ex.HResult); } } TestLogger.LogMessage("Leave Metering.MeteringReportProactively()"); }
void VerifyLicensesShouldExist(Guid keyIdGuid, bool bFullyEvaluated, uint?uintCount) { IPlayReadyLicense[] licenses = LicenseManagement.FindMultipleLicenses(keyIdGuid, string.Empty, bFullyEvaluated); if (licenses == null) { TestLogger.LogMessage("Licenses not found!!!"); TestActionFinished(false, null); } else { if (!uintCount.HasValue) { TestActionFinished(true, null); } else { if (licenses.Length == uintCount.Value) { TestLogger.LogMessage("License count matched!!!"); TestActionFinished(true, null); } else { TestLogger.LogMessage("License count not matching!!!"); TestActionFinished(false, null); } } } }
public void DomainLeaveProactively() { TestLogger.LogMessage("Enter DomainLeave.DomainLeaveProactively()"); try { PlayReadyDomainLeaveServiceRequest domainLeaveRequest = new PlayReadyDomainLeaveServiceRequest(); DomainLeaveReactively(domainLeaveRequest); } 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 { TestLogger.LogMessage("DomainLeaveProactively failed:" + ex.HResult); } } TestLogger.LogMessage("Leave DomainLeave.DomainLeaveProactively()"); }
public void SecureStopProactively() { TestLogger.LogMessage("Enter SecureStop.SecureStopReportProactively()"); try { TestLogger.LogMessage("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 { TestLogger.LogImportantMessage("SecureStopProactively failed:" + ex.HResult); } } TestLogger.LogMessage("Leave SecureStop.SecureStopReportProactively()"); }
void VerifyDomainsShouldExist(Guid guidAccountId, uint?uintCount) { IPlayReadyDomain[] domains = DomainManagement.FindMultipleDomains(guidAccountId); if (domains == null) { TestLogger.LogMessage("Domains not found!!!"); TestActionFinished(false, null); } else { if (!uintCount.HasValue) { TestActionFinished(true, null); } else { if (domains.Length == uintCount.Value) { TestLogger.LogMessage("Domain count matched!!!"); TestActionFinished(true, null); } else { TestLogger.LogMessage("Domain count not matching!!!"); TestActionFinished(false, null); } } } }
protected override bool HandleExpectedError(Exception ex) { TestLogger.LogImportantMessage("Enter LAAndReportResult.HandleExpectedError()"); if (string.IsNullOrEmpty(_strExpectedError)) { TestLogger.LogMessage("Setting error code to " + RequestConfigData.ExpectedLAErrorCode); _strExpectedError = RequestConfigData.ExpectedLAErrorCode; } bool bHandled = false; if (!string.IsNullOrEmpty(_strExpectedError)) { if (ex.Message.ToLower().Contains(_strExpectedError.ToLower())) { TestLogger.LogImportantMessage("'" + ex.Message + "' Contains " + _strExpectedError + " as expected"); bHandled = true; _reportResult(true, sampleDataItem); } } TestLogger.LogImportantMessage("Leave LAAndReportResult.HandleExpectedError()"); return(bHandled); }
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 HandleRevocationReactively(PlayReadyRevocationServiceRequest request) { TestLogger.LogMessage("Enter Revocation.HandleRevocationReactively()"); Exception exception = null; try { _serviceRequest = request; TestLogger.LogMessage("Begin revocation service request..."); await request.BeginServiceRequest(); } catch (Exception ex) { TestLogger.LogMessage("Saving exception.."); exception = ex; } finally { TestLogger.LogMessage("Post-RevocationServiceRequest Values:"); if (exception == null) { TestLogger.LogMessage("ResponseCustomData = " + request.ResponseCustomData); TestLogger.LogMessage("ProtectionSystem = " + request.ProtectionSystem.ToString()); TestLogger.LogMessage("Type = " + request.Type.ToString()); } RevocationServiceRequestCompleted(request, exception); } TestLogger.LogMessage("Leave Revocation.HandleRevocationReactively()"); }
protected override void EnablingActionCompleted(bool bResult) { TestLogger.LogMessage("Enter LAAndReportResult.EnablingActionCompleted()"); _reportResult(bResult, sampleDataItem); TestLogger.LogMessage("Leave LAAndReportResult.EnablingActionCompleted()"); }
void HandleServiceRequest_Finished(bool bResult, object resultContext) { TestLogger.LogMessage("Enter RequestChain.HandleServiceRequest_Finished()"); _reportResult(bResult, null); TestLogger.LogMessage("Leave RequestChain.HandleServiceRequest_Finished()"); }
protected override void EnablingActionCompleted(bool bResult) { TestLogger.LogMessage("Enter IndivAndReportResult.EnablingActionCompleted()"); _reportResult(bResult, null); TestLogger.LogMessage("Leave IndivAndReportResult.EnablingActionCompleted()"); }
void RequestChain_Finished(bool bResult, object resultContext) { TestLogger.LogMessage("Enter ServiceRequest.RequestChain_Finished()"); EnablingActionCompleted(bResult); TestLogger.LogMessage("Leave ServiceRequest.RequestChain_Finished()"); }
void HandleServiceRequest_Finished(bool bResult, object resultContext) { TestLogger.LogMessage("Enter Playback.HandleServiceRequest_Finished()"); TestLogger.LogMessage("MediaProtectionServiceCompletion.Complete = " + bResult.ToString()); _serviceCompletionNotifier.Complete(bResult); TestLogger.LogMessage("Leave Playback.HandleServiceRequest_Finished()"); }
public void Test_ResetServiceRequestStatistics() { TestLogger.LogMessage("Enter Test_ResetServiceRequestStatistics()"); SerivceRequestStatistics.Reset(); TestActionFinished(true, null); TestLogger.LogMessage("Leave Test_ResetServiceRequestStatistics()"); }
void SetupProtectionManager(MediaElement mediaElement) { TestLogger.LogMessage("Enter Playback.SetupProtectionManager()"); _mediaElement = mediaElement; TestLogger.LogMessage("Creating protection system mappings..."); _protectionManager = new MediaProtectionManager(); _protectionManager.ComponentLoadFailed += new ComponentLoadFailedEventHandler(ProtectionManager_ComponentLoadFailed); _protectionManager.ServiceRequested += new ServiceRequestedEventHandler(ProtectionManager_ServiceRequested); TestLogger.LogMessage("Creating protection system mappings..."); //Setup PlayReady as the ProtectionSystem to use by MF. //The code here is mandatory and should be just copied directly over to the app Windows.Foundation.Collections.PropertySet cpSystems = new Windows.Foundation.Collections.PropertySet(); //Indicate to the MF pipeline to use PlayReady's TrustedInput cpSystems.Add("{F4637010-03C3-42CD-B932-B48ADF3A6A54}", "Windows.Media.Protection.PlayReady.PlayReadyWinRTTrustedInput"); _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemIdMapping", cpSystems); //Use by the media stream source about how to create ITA InitData. //See here for more detai: https://msdn.microsoft.com/en-us/library/windows/desktop/aa376846%28v=vs.85%29.aspx _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionSystemId", "{F4637010-03C3-42CD-B932-B48ADF3A6A54}"); // Setup the container GUID that's in the PPSH box _protectionManager.Properties.Add("Windows.Media.Protection.MediaProtectionContainerGuid", "{9A04F079-9840-4286-AB92-E65BE0885F95}"); TestLogger.LogMessage("Creating media extension manager..."); _extensions = new Windows.Media.MediaExtensionManager(); TestLogger.LogMessage("Registering ByteStreamHandlers for PIFF content"); _extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "text/xml"); _extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml"); Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; //Setup Software Override based on app setting //By default, PlayReady uses Hardware DRM if the machine support it. However, in case the app still want //software behavior, they can set localSettings.Containers["PlayReady"].Values["SoftwareOverride"]=1. //This code tells MF to use software override as well if (localSettings.Containers.ContainsKey("PlayReady") && localSettings.Containers["PlayReady"].Values.ContainsKey("SoftwareOverride")) { int UseSoftwareProtectionLayer = (int)localSettings.Containers["PlayReady"].Values["SoftwareOverride"]; if (UseSoftwareProtectionLayer == 1) { TestLogger.LogMessage(" "); TestLogger.LogMessage("***** Use Software Protection Layer ******"); _protectionManager.Properties.Add("Windows.Media.Protection.UseSoftwareProtectionLayer", true); } } _mediaElement.ProtectionManager = _protectionManager; TestLogger.LogMessage("Leave Playback.SetProtectionManager()"); }