setCaptionStylePreference

public boolean setCaptionStylePreference(Bundle preference)

Applies user-specified caption styling preferences to the subtitle view.

This method accepts a Bundle containing caption styling rules and applies the styles to the subtitle view. It ensures only valid attribute keys and values are accepted, throwing an error otherwise.

Supported Bundle keys and values:

  • "text_color" - Text color as hex RGB string (e.g., "#FFFFFF") or "default".
  • "bg_color" - Background color (same format as above).
  • "edge_color" - Outline/shadow color (same format as above).
  • "edge_type" - One of: "none", "raised", "depressed", "uniform", "right_drop_shadow".
  • "text_opacity" - One of: "solid", "flash", "translucent", "transparent", "default".
  • "bg_opacity" - Same values as text_opacity.
  • "size" - One of: "small", "medium", "large", or "default".
  • "type" - Font typeface. One of:
    • "default"
    • "mono_sp_with_serifs" → "serif-monospace"
    • "prop_sp_with_serifs" → "serif"
    • "mono_sp_without_serifs" → "monospace"
    • "prop_sp_without_serifs" → "sans-serif"
    • "casual"
    • "cursive"
    • "small_capitals"
  • "style" - Text style: "normal", "italic", "underline", "italic_underline", or "default".
  • "preview" (optional) - If true, displays sample cues for visual preview.

Invalid keys or unsupported values will result in IllegalArgumentException. If the subtitle view is not available, the method returns false.

Example usage:

Bundle style = new Bundle();
style.putString("text_color", "#FFFF00");
style.putString("bg_color", "#000000");
style.putString("edge_type", "uniform");
style.putString("type", "cursive");
style.putString("style", "italic");
style.putString("size", "large");
style.putBoolean("preview", true);
boolean success = player.setCaptionStylePreference(style);

Return

true if the style was applied successfully, false if not applicable.

Parameters

preference

A Bundle defining caption style rules.

Throws

if unknown keys or invalid values are provided.