You can style the closed-caption text with PSDK methods.
You can optionally provide all the closed-caption styling parameters at construction time, or set them later.
The PSDK encapsulates closed-caption styling information inside the TextFormat interface. The TextFormatBuilder is a utility class that allows you to obtain a reference to an object that implements this interface.
public TextFormatBuilder( Font font, Size size, FontEdge fontEdge, Color fontColor, Color backgroundColor, Color fillColor, Color edgeColor, int fontOpacity, int backgroundOpacity, int fillOpacity)
public TextFormat toTextFormat()
/** * @return the current closed captioning style. * If no style was previously set, it returns a TextFormat object * with default values for each attribute. * @throws IllegalStateException if media player was already released. */ public TextFormat getCCStyle() throws IllegalStateException;
public Color getFontColor(); public Color getBackgroundColor(); public Color getFillColor(); // retrieve the font fill color public Color getEdgeColor(); // retrieve the font edge color public Size getSize(); // retrieve the font size public FontEdge getFontEdge(); // retrieve the font edge type public Font getFont(); // retrieve the font type public int getFontOpacity(); public int getBackgroundOpacity();
/** * Sets the closed captioning style. Used to control the closed captioning font, * size, color, edge and opacity. * * This method is safe to use even if the current media stream doesn't have closed * captions. * * @param textFormat * @throws IllegalStateException */ public void setCCStyle(TextFormat textFormat) throws IllegalStateException;
The TextFormat interface defines an immutable object: there are only getter methods and no setters. You can set the closed-caption styling parameters only when dealing with the TextFormatBuilder class.
// set font type public void setFont(Font font) public void setBackgroundColor(Color backgroundColor) public void setFillColor(Color fillColor) // set the font-edge color public void setEdgeColor(Color edgeColor) // set the font size public void setSize(Size size) // set the font edge type public void setFontEdge(FontEdge fontEdge) public void setFontOpacity(int fontOpacity) public void setBackgroundOpacity(int backgroundOpacity) // set the font-fill opacity level public void setFillOpacity(int fillOpacity) public void setFontColor(Color fontColor)