/// <summary> /// Update the Caption options /// </summary> /// <param name="settings">the custom caption settings</param> private void UpdateCaptionOptions(PlayerFramework.CaptionSettings.Model.CustomCaptionSettings settings) { CC608Plugin cc608plugIn = this.MediaPlayer.Plugins.OfType <CC608Plugin>().FirstOrDefault(); if (cc608plugIn != null) { var fontFamily = GetFontFamilyName(settings.FontFamily); var captionOptions = new Microsoft.PlayerFramework.CC608.CaptionOptions { FontFamily = fontFamily == null ? string.Empty : fontFamily, FontSize = settings.FontSize.HasValue ? settings.FontSize.Value : 100, FontBrush = settings.FontColor == null ? null : new SolidColorBrush(settings.FontColor.ToColor()), BackgroundBrush = settings.BackgroundColor == null ? null : new SolidColorBrush(settings.BackgroundColor.ToColor()), VideoWidth = this.MediaPlayer.ActualWidth }; if (settings.FontFamily == PlayerFramework.CaptionSettings.Model.FontFamily.Default || settings.FontFamily == PlayerFramework.CaptionSettings.Model.FontFamily.MonospaceSansSerif || settings.FontFamily == PlayerFramework.CaptionSettings.Model.FontFamily.MonospaceSerif) { captionOptions.CaptionWidth = 0; } else { double fontSize = 100; switch (captionOptions.FontSize) { case 50: fontSize = 75; break; case 100: break; case 150: fontSize = 120; break; case 200: fontSize = 130; break; } captionOptions.CaptionWidth = fontSize * this.MediaPlayer.ActualWidth * 0.5 / 100.0; } cc608plugIn.CaptionOptions = captionOptions; } }
/// <summary> /// Update the Caption options /// </summary> /// <param name="settings">the custom caption settings</param> private void UpdateCaptionOptions(PlayerFramework.CaptionSettings.Model.CustomCaptionSettings settings) { CC608Plugin cc608plugIn = this.MediaPlayer.Plugins.OfType<CC608Plugin>().FirstOrDefault(); if (cc608plugIn != null) { var fontFamily = GetFontFamilyName(settings.FontFamily); var captionOptions = new Microsoft.PlayerFramework.CC608.CaptionOptions { FontFamily = fontFamily == null ? string.Empty : fontFamily, FontSize = settings.FontSize.HasValue ? settings.FontSize.Value : 100, FontBrush = settings.FontColor == null ? null : new SolidColorBrush(settings.FontColor.ToColor()), BackgroundBrush = settings.BackgroundColor == null ? null : new SolidColorBrush(settings.BackgroundColor.ToColor()), VideoWidth = this.MediaPlayer.ActualWidth }; if (settings.FontFamily == PlayerFramework.CaptionSettings.Model.FontFamily.Default || settings.FontFamily == PlayerFramework.CaptionSettings.Model.FontFamily.MonospaceSansSerif || settings.FontFamily == PlayerFramework.CaptionSettings.Model.FontFamily.MonospaceSerif) { captionOptions.CaptionWidth = 0; } else { double fontSize = 100; switch (captionOptions.FontSize) { case 50: fontSize = 75; break; case 100: break; case 150: fontSize = 120; break; case 200: fontSize = 130; break; } captionOptions.CaptionWidth = fontSize * this.MediaPlayer.ActualWidth * 0.5 / 100.0; } cc608plugIn.CaptionOptions = captionOptions; } }