Set closed-caption styles

You can set the format, such as font, size, color, edge, and opacity for closed-caption text.

  1. Wait for the MediaPlayer to be at least in the PREPARED state.

    For more information about the states, see Wait for a valid state.

  2. Create a TextFormat instance.

    You can provide all the closed-caption styling parameters now or set them later.

    new TextFormat( 
        font,   
        fontColor,  
        edgeColor,   
        fontEdge,  
        backgroundColor,   
        fillColor,  
        size,   
        fontOpacity,   
        backgroundOpacity,  
        fillOpacity, 
        bottomInset 
        safeArea) → {AdobePSDK.TextFormat}
    
  3. (Optional) Get the current closed-caption style settings with MediaPlayer.ccStyle.

    The return value is an instance of the TextFormat interface.

    If no style was previously set, it returns a TextFormat object with default values for each attribute:

    ccStyle :AdobePSDK.TextFormat
    
  4. To change the style settings, use MediaPlayer.ccStyle, passing an instance of the TextFormat interface.

    You can use this method even if the current media stream has no closed captions.

    ccStyle :AdobePSDK.TextFormat 
    
    TIP

    Setting the closed-caption style is asynchronous, so it might take a few seconds for the changes to appear on the screen.

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free