Class CaptionsConfig.Builder

java.lang.Object
com.jwplayer.pub.api.configuration.CaptionsConfig.Builder
Enclosing class:
CaptionsConfig

public static class CaptionsConfig.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
    • Builder

      public Builder(@NonNull CaptionsConfig src)
      This constructor fills the builder with data from an existing CaptionsConfig in case you need to duplicate one and make a small change.
      Parameters:
      src - the config to copy.
  • Method Details

    • fontSize

      public CaptionsConfig.Builder fontSize(Integer fontSize)
      Sets the caption font size in Android scaled pixels (sp). When set, this size is used as the base size and overrides the player's automatic sizing. See CaptionsConfig.getFontSize() for how the unit relates to the other platforms.
      Parameters:
      fontSize - the size in sp; null, zero and negative values leave the player's automatic sizing in place.
    • fontFamily

      public CaptionsConfig.Builder fontFamily(String fontFamily)
      Sets the caption font family (e.g. "sans-serif", "serif", "monospace").
      Parameters:
      fontFamily - the font family name.
    • color

      public CaptionsConfig.Builder color(@ColorInt Integer color)
      Sets the caption text color. The color's alpha component sets the text opacity.
      Parameters:
      color - the text color, including opacity.
    • backgroundColor

      public CaptionsConfig.Builder backgroundColor(@ColorInt Integer backgroundColor)
      Sets the color rendered directly behind the caption glyphs (the "highlight"). The color's alpha component sets the opacity. When left unset, the highlight defaults to an opaque black box (Android's default caption rendering); pass a color with alpha 0 to remove it. This is distinct from the caption window (windowColor(Integer)).
      Parameters:
      backgroundColor - the highlight color, including opacity.
    • windowColor

      public CaptionsConfig.Builder windowColor(@ColorInt Integer windowColor)
      Sets the color of the window/box behind the whole caption region. The color's alpha component sets the opacity. Use this to place captions on a solid or translucent background for legibility.
      Parameters:
      windowColor - the window color, including opacity.
    • edgeStyle

      public CaptionsConfig.Builder edgeStyle(String edgeStyle)
      Sets the edge style applied around caption text.
      Parameters:
      edgeStyle - one of the EDGE_STYLE_ constants.
    • position

      public CaptionsConfig.Builder position(CaptionPosition position)
      Sets the default position, width and text alignment of captions within the rendered video. Applies only to cues that carry no positioning of their own; see CaptionPosition for the precedence rules and the coordinate space.
      Parameters:
      position - the caption position, or null to leave the player's positioning in place.
    • overrideStrategy

      public CaptionsConfig.Builder overrideStrategy(String overrideStrategy)
      Sets the strategy governing whether developer-provided styles override the device's accessibility caption settings.
      Parameters:
      overrideStrategy - one of the OVERRIDE_STRATEGY_ constants.
    • allowScaling

      public CaptionsConfig.Builder allowScaling(boolean allowScaling)
      Sets whether the device's accessibility caption/font scale is applied on top of the caption size. Defaults to true. See CaptionsConfig.getAllowScaling().
      Parameters:
      allowScaling - true to apply the accessibility scale, false to use the configured or automatic size as-is.
    • build

      public CaptionsConfig build()