Also refer to the PMPDemoApp, which includes these operations in the scrub-bar controls.
private final MediaPlayer.PlaybackEventListener _playbackEventListener =
new MediaPlayer.PlaybackEventListener() {
@Override
public void onPrepared() {
// Set CC style.
TextFormat tf = new TextFormatBuilder(TextFormat.Font.DEFAULT,
TextFormat.Size.DEFAULT,
TextFormat.FontEdge.DEFAULT,
TextFormat.Color.DEFAULT,
TextFormat.Color.DEFAULT,
TextFormat.Color.DEFAULT,
TextFormat.Color.DEFAULT,
TextFormat.DEFAULT_OPACITY,
TextFormat.DEFAULT_OPACITY,
TextFormat.DEFAULT_OPACITY).toTextFormat();
mediaPlayer.setCCStyle(tf);
...
}
}
/** * Constructor using parameters to initialize a TextFormat. * * @param font * The desired font. * @param size * The desired text size. * @param fontEdge * The desired font edge. * @param fontColor * The desired font color. * @param backgroundColor * The desired background color. * @param fillColor * The desired fill color. * @param edgeColor * The desired color to draw the text edges. * @param fontOpacity * The desired font opacity. * @param backgroundOpacity * The desired background opacity. * @param fillOpacity * The desired fill opacity. */ public TextFormatBuilder(Font font, Size size, FontEdge fontEdge, Color fontColor, Color backgroundColor, Color fillColor, Color edgeColor, int fontOpacity, int backgroundOpacity, int fillOpacity); /** * Creates a TextFormat with the parameters supplied to this builder. */ public TextFormat toTextFormat(); /** * Sets the text font. * @param font The desired font * @return This builder object to allow chaining calls */ public TextFormatBuilder setFont(Font font); ....