Esempio n. 1
0
        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(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.");
        }
Esempio n. 3
0
        //<SnippetHdcpSessionMethod>
        private void SetHdcpProtection()
        {
            hdcpSession = new HdcpSession();

            // Register an event to get notified when HDCP changes
            hdcpSession.ProtectionChanged += (HdcpSession sender, object eventArgs) =>
            {
                // In case we want to do something with the level
                HdcpProtection?protection = sender.GetEffectiveProtection();

                if (protection != null)
                {
                    currentHdcpProtection = protection.Value;
                }
                else
                {
                    // The current Hdcp protection level is pending... so treat it as though it's off altogether
                    currentHdcpProtection = HdcpProtection.Off;
                }

                // Check the protection
                outputIsProtected = sender.IsEffectiveProtectionAtLeast(desiredHdcpProtection);
            };

            hdcpSession.SetDesiredMinProtectionAsync(desiredHdcpProtection).Completed = (asyncOperation, asyncStatus) =>
            {
                if (HdcpSetProtectionResult.Success != asyncOperation.GetResults())
                {
                    // Handle the case where we failed to set the HDCP protection
                    DebugTextBlock.Text = "ERROR! Something went wrong";
                }

                outputIsProtected = hdcpSession.IsEffectiveProtectionAtLeast(desiredHdcpProtection);
            };
        }
        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, adaptiveMediaSource);
            };

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

            // We use a helper class that logs all the events for the MediaPlayer:
            mediaPlayerLogger = new MediaPlayerLogger(LoggerControl, mediaPlayer);

            mediaPlayerElement.SetMediaPlayer(mediaPlayer);

            ContentSelectorControl.Initialize(
                mediaPlayer,
                MainPage.ContentManagementSystemStub.Where(m => !m.PlayReady),
                null,
                LoggerControl,
                LoadSourceFromUriAsync);

            ContentSelectorControl.HideLoadUri(); // Avoid free text URIs for this scenario.

            // 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.");
            ContentSelectorControl.SetSelectedModel(MainPage.ContentManagementSystemStub.Where(m => m.Id == 13).FirstOrDefault());
        }
Esempio n. 5
0
        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.");
        }