Beispiel #1
0
        /// <summary>
        /// Update the caption content
        /// </summary>
        private async void UpdateCaptionContent()
        {
            var updateRequired = await _controller.CaptionUpdateRequiredAsync(MediaPlayer.Position);

            if (updateRequired)
            {
                var captionData = _controller.GetXamlCaptions(
                    (ushort)MediaPlayer.ActualHeight);

                if (captionData.RequiresUpdate)
                {
                    _captionsContainer.Children.Clear();

                    // If an OnCaptionAdded event handler has been added, call
                    // it to modify the caption Xaml before adding it to the
                    // scene.
                    if (this.OnCaptionAdded != null)
                    {
                        this.OnCaptionAdded(this, new UIElementEventArgs(captionData.CaptionsRoot));
                    }

                    _captionsContainer.Children.Add(captionData.CaptionsRoot);
                }
            }
        }