Пример #1
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            var codecQuery = new CodecQuery();
            IReadOnlyList <CodecInfo> result;

            try
            {
                result = await codecQuery.FindAllAsync(CodecKind.Video, CodecCategory.Decoder, CodecSubtypes.VideoFormatHevc);
            }
            catch (Exception ex)
            {
                throw;
            }

            StringBuilder sb = new StringBuilder();

            foreach (var codecInfo in result)
            {
                sb.Append("============================================================\n");
                sb.Append(string.Format("Codec: {0}\n", codecInfo.DisplayName));
                sb.Append(string.Format("Kind: {0}\n", codecInfo.Kind.ToString()));
                sb.Append(string.Format("Category: {0}\n", codecInfo.Category.ToString()));
                sb.Append(string.Format("Trusted: {0}\n", codecInfo.IsTrusted.ToString()));

                foreach (string subType in codecInfo.Subtypes)
                {
                    sb.Append(string.Format("   Subtype: {0}\n", subType));
                }
            }

            Debug.WriteLine(sb.ToString());

            _player              = new MediaPlayer();
            _player.MediaFailed += Player_MediaFailed;
            _player.AutoPlay     = true;
            _player.PlaybackSession.BufferingStarted += PlaybackSession_BufferingStarted;
            _player.BufferingStarted += Player_BufferingStarted;
            _player.PlaybackSession.PlaybackStateChanged += PlaybackSession_PlaybackStateChanged;

            _protectionManager        = PlayReadyHelpers.InitializeProtectionManager(ServiceRequested);
            _player.ProtectionManager = _protectionManager;

            //_playReadyHelper = new PlayReadyHelper(); // From SDKTemplate.Helpers.PlayReadyHelper
            //_playReadyHelper.SetUpProtectionManager(_player);

            mediaPlayerElement.SetMediaPlayer(_player);
            mediaPlayerElement.AutoPlay = true;
        }
Пример #2
0
        /// <summary>
        /// The helper class will determine the exact type of ServiceRequest in order to customize and send
        /// the service request. ServiceRequests (except for Individualization and Revocation) also support the
        /// GenerateManualEnablingChallenge method. This can be used to read and customize the SOAP challenge
        /// and manually send the challenge.
        /// </summary>
        async Task ProcessServiceRequest(IMediaProtectionServiceRequest serviceRequest)
        {
            //Alternatively the serviceRequest can be determined by the Guid serviceRequest.Type
            if (serviceRequest is PlayReadyIndividualizationServiceRequest)
            {
                PlayReadyHelpers.ReactiveIndividualization(serviceRequest as PlayReadyIndividualizationServiceRequest, serviceCompletionNotifier, () => RefreshPlayreadyStats());
                RefreshPlayreadyStats();
            }
            else if (serviceRequest is PlayReadyLicenseAcquisitionServiceRequest)
            {
                var licenseRequest = serviceRequest as PlayReadyLicenseAcquisitionServiceRequest;
                // The initial service request url was taken from the playready header from the dash manifest.
                // This can overridden to a different license service prior to sending the request (staging, production,...).

                if (!String.IsNullOrWhiteSpace(_licenseOverride))
                {
                    licenseRequest.Uri = new Uri(_licenseOverride);
                }

                PlayReadyHelpers.ReactiveLicenseAcquisition(licenseRequest, serviceCompletionNotifier);
            }
        }