private async void Page_OnLoaded(object sender, RoutedEventArgs e) { // 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 void Page_OnLoaded(object sender, RoutedEventArgs e) { // 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(object sender, RoutedEventArgs e) { 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() { 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); }