private void Page_OnLoaded(object sender, RoutedEventArgs e) { // We enforce HDCP in this scenario that uses encryption but not PlayReady. hdcpSession = new HdcpSession(); // The protection level may change if screens are plugged or unplugged from the system or // if explicitly set in the radio buttons in the UI. hdcpSession.ProtectionChanged += (HdcpSession session, object args) => { // After a change, impose a maximum bitrate based on the actual protection level. HdcpProtection?protection = session.GetEffectiveProtection(); SetMaxBitrateForProtectionLevel(protection, adaptiveMS); }; // Choose a default content, and tell the user that some content IDs // require an authorization mode. Filter out the PlayReady content // because this scenario does not support PlayReady. SelectedContent.ItemsSource = MainPage.ContentManagementSystemStub.Where(model => !model.PlayReady); SelectedContent.SelectedItem = MainPage.FindContentById(13); // Initialize tokenMethod based on the default selected radio button. var defaultRadioButton = AzureAuthorizationMethodPanel.Children.OfType <RadioButton>().First(button => button.IsChecked.Value); Enum.TryParse((string)defaultRadioButton.Tag, out tokenMethod); Log("Content Id 13 and 14 require that you choose an authorization method."); }
private void Page_OnLoaded() { // NOTE: Change this to 110 to see DASH with PlayReady scenario const int contentIdForCMS = 1; AdaptiveContentModel adaptiveContentModel = MainPage.FindContentById(contentIdForCMS); if (adaptiveContentModel.PlayReady) { // For PlayReady, we need to create and setup MediaPlayer.MediaProtectionManager // All scenarios use a helper class to do this, see Helpers\PlayReadyHelper.cs var mp = new MediaPlayer(); var prHelper = new PlayReadyHelper(); // From SDKTemplate.Helpers.PlayReadyHelper prHelper.SetUpProtectionManager(mp); mediaPlayerElement.SetMediaPlayer(mp); } mediaPlayerElement.Source = MediaSource.CreateFromUri(adaptiveContentModel.ManifestUri); }
private async void Page_OnLoaded() { // Explicitly create the instance of MediaPlayer if you need to register for its events // (like MediaOpened / MediaFailed) prior to setting an IMediaPlaybackSource. var mediaPlayer = new MediaPlayer(); RegisterForMediaPlayerEvents(mediaPlayer); // Ensure we have PlayReady support, if the user enters a DASH/PR Uri in the text box: var prHelper = new PlayReadyHelper(LoggerControl); prHelper.SetUpProtectionManager(mediaPlayer); mediaPlayerElement.SetMediaPlayer(mediaPlayer); AdaptiveContentModel adaptiveContentModel = MainPage.FindContentById(1); UriBox.Text = adaptiveContentModel.ManifestUri.ToString(); LoadSourceFromUriTask = LoadSourceFromUriAsync(adaptiveContentModel.ManifestUri); await LoadSourceFromUriTask; }
private async void Page_OnLoaded() { var mediaPlayer = new MediaPlayer(); RegisterForMediaPlayerEvents(mediaPlayer); // Ensure we have PlayReady support, in case the user enters a DASH/PR Uri in the text box. var prHelper = new PlayReadyHelper(LoggerControl); prHelper.SetUpProtectionManager(mediaPlayer); mediaPlayerElement.SetMediaPlayer(mediaPlayer); // Choose a default content. SelectedContent.ItemsSource = MainPage.ContentManagementSystemStub; adaptiveContentModel = MainPage.FindContentById(1); SelectedContent.SelectedItem = adaptiveContentModel; UriBox.Text = adaptiveContentModel.ManifestUri.ToString(); await LoadSourceFromUriAsync(adaptiveContentModel.ManifestUri); }
private async void Page_OnLoaded(object sender, RoutedEventArgs e) { var mediaPlayer = new MediaPlayer(); RegisterForMediaPlayerEvents(mediaPlayer); // Ensure we have PlayReady support, if the user enters a DASH/PR Uri in the text box: var prHelper = new PlayReadyHelper(LoggerControl); prHelper.SetUpProtectionManager(mediaPlayer); mediaPlayerElement.SetMediaPlayer(mediaPlayer); // Choose a default content. SelectedContent.ItemsSource = MainPage.ContentManagementSystemStub.ToArray(); adaptiveContentModel = MainPage.FindContentById(10); SelectedContent.SelectedItem = adaptiveContentModel; UriBox.Text = adaptiveContentModel.ManifestUri.ToString(); await LoadSourceFromUriAsync(adaptiveContentModel.ManifestUri); // There is no InboundBitsPerSecondChanged event, so we start a polling thread to update UI. PollForInboundBitsPerSecond(ctsForInboundBitsPerSecondUiRefresh); }
private void Page_OnLoaded() { // We enforce HDCP in this scenario that uses encryption but not PlayReady. hdcpSession = new HdcpSession(); // The protection level may change if screens are plugged or unplugged from the system or // if explicitly set in the radio buttons in the UI. hdcpSession.ProtectionChanged += (HdcpSession session, object args) => { // After a change, impose a maximum bitrate based on the actual protection level. HdcpProtection?protection = session.GetEffectiveProtection(); SetMaxBitrateForProtectionLevel(protection, adaptiveMS); }; // Choose a default content, and tell the user that some content IDs // require an authorization mode. Filter out the PlayReady content // because this scenario does not support PlayReady. SelectedContent.ItemsSource = MainPage.ContentManagementSystemStub.Where(model => !model.PlayReady); SelectedContent.SelectedItem = MainPage.FindContentById(13); tokenMethod = AzureKeyAcquisitionMethod.None; Log("Content Id 13 and 14 require that you choose an authorization method."); }