Class CaptionPosition.Builder

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

public static class CaptionPosition.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
    • Builder

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

    • width

      public CaptionPosition.Builder width(Integer width)
      Sets the width of the caption box as a percentage of the rendered video width. When left unset, the box is sized to fit the caption text.
      Parameters:
      width - the width as a percentage; values outside [0, 100] are clamped into range, and null restores the default.
    • alignment

      public CaptionPosition.Builder alignment(String alignment)
      Sets the alignment of the caption text within the caption box.
      Parameters:
      alignment - one of the ALIGNMENT_ constants.
    • horizontalPosition

      public CaptionPosition.Builder horizontalPosition(Integer horizontalPosition)
      Sets the leading edge of the caption box as a percentage of the rendered video width. When left unset, the box is centered horizontally.
      Parameters:
      horizontalPosition - the position as a percentage; values outside [0, 100] are clamped into range, and null restores the default.
    • linePercentage

      public CaptionPosition.Builder linePercentage(Integer linePercentage)
      Sets the top edge of the caption box as a percentage of the rendered video height, measured from the top.

      Calling this clears any value set by lineIndex(Integer), as the two describe the same axis. iOS rejects a position carrying both at build() time; this builder takes the value set last instead, so that a position can be adjusted without having to clear the other property first.

      Parameters:
      linePercentage - the position as a percentage; values outside [0, 100] are clamped into range, and null restores the default.
    • lineIndex

      public CaptionPosition.Builder lineIndex(Integer lineIndex)
      Sets the vertical position of the caption box as a line count. A non-negative value counts lines down from the top of the rendered video; a negative value counts lines up from the bottom, so -1 is the bottom line.

      Calling this clears any value set by linePercentage(Integer) — see the note there.

      Parameters:
      lineIndex - the line count, or null to restore the default.
    • build

      public CaptionPosition build()