diff --git a/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt b/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt index 7afa7804e3..576664c3c1 100644 --- a/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt +++ b/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt @@ -71,6 +71,7 @@ object PreferenceKeys { const val SEARCH_HISTORY_TOGGLE = "search_history_toggle" const val SYSTEM_CAPTION_STYLE = "system_caption_style" const val CAPTION_SETTINGS = "caption_settings" + const val RICH_CAPTION_RENDERING = "rich_caption_rendering" const val SEEK_INCREMENT = "seek_increment" const val DEFAULT_RESOLUTION = "default_res" const val DEFAULT_RESOLUTION_MOBILE = "default_res_mobile" diff --git a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt index 49215f71d2..d717a6fdc3 100644 --- a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt @@ -165,6 +165,12 @@ object PlayerHelper { true ) + val useRichCaptionRendering: Boolean + get() = PreferenceHelper.getBoolean( + PreferenceKeys.RICH_CAPTION_RENDERING, + false + ) + private val bufferingGoal: Int get() = PreferenceHelper.getString( PreferenceKeys.BUFFERING_GOAL, diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index 4511e0f74f..24f3bf5917 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -605,8 +605,8 @@ open class CustomExoPlayerView( val captionStyle = PlayerHelper.getCaptionStyle(context) subtitleView?.apply { setApplyEmbeddedFontSizes(false) - setViewType(SubtitleView.VIEW_TYPE_WEB) setFixedTextSize(Cue.TEXT_SIZE_TYPE_ABSOLUTE, PlayerHelper.captionsTextSize) + if (PlayerHelper.useRichCaptionRendering) setViewType(SubtitleView.VIEW_TYPE_WEB) if (!PlayerHelper.useSystemCaptionStyle) return setApplyEmbeddedStyles(captionStyle == CaptionStyleCompat.DEFAULT) setStyle(captionStyle) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b7fd1fd5a2..9e4e603d65 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -223,6 +223,8 @@ Remembered playback positions Reset System caption style + Rich caption rendering + Render web captions for a more rich and customized experience. Captions None General diff --git a/app/src/main/res/xml/player_settings.xml b/app/src/main/res/xml/player_settings.xml index 30ebd0026e..b65ddceb28 100644 --- a/app/src/main/res/xml/player_settings.xml +++ b/app/src/main/res/xml/player_settings.xml @@ -123,6 +123,13 @@ app:key="caption_settings" app:title="@string/caption_settings" /> + +