Microsoft.PlayerFramework.Adaptive.HLS.HLSPlugin.MediaPlayer_SelectedCaptionChanged C# (CSharp) Method

MediaPlayer_SelectedCaptionChanged() private method

The selected closed caption has changed.
private MediaPlayer_SelectedCaptionChanged ( object sender, RoutedPropertyChangedEventArgs
e ) : void
sender object MMPPF media player.
e RoutedPropertyChangedEventArgs
Selected closed caption data.
return void
    private async void MediaPlayer_SelectedCaptionChanged(object sender, RoutedPropertyChangedEventArgs<Caption> e)
    {
      try
      {
        // only process for WebVTT captions
        if (ClosedCaptionType.WebVTTSidecar != this._CaptionType)
          return;

        if (null != this._WebVTTCaptions)
        {
          this._WebVTTCaptions.Cancel();
          this._WebVTTCaptions = null;
        }

        if (null != e.NewValue && this._Controller.IsValid)
        {
          this._WebVTTCaptions = new HLSWebVTTCaptions(this._MediaPlayer, _Controller);
          await this._WebVTTCaptions.DownloadAllSegmentsAsync(e.NewValue.Id, this._MediaPlayer.Position);
        }
      }
      catch  { }
    }