AlexaCaptions 1

The AlexaCaptions interface exposes directives and events to enable the inter-process communication (IPC) client to control and display Alexa captions.

{
    "namespace": "AlexaCaptions",
    "version": 1
}

Directives

Outbound messages from the Alexa client about the display of Alexa captions.

renderCaptions

Provides the IPC client with the payload required to render a text-to-speech synchronized presentation of Alexa captions.

Example message

{
    "header": {
        "version": 1
        "namespace": "AlexaCaptions",
        "name": "renderCaptions"
    },
    "payload": {
        "duration": {{NUMBER}},
        "delay": {{NUMBER}}
        "captionLines": [
            {
                "text": "{{STRING}}",
                "styles": [
                    {
                        "charIndex": "{{STRING}}",
                        "activeStyle": {
                            "bold": {{BOOLEAN}},
                            "italic": {{BOOLEAN}},
                            "underline": {{BOOLEAN}}
                        }
                    },
                    ...
                ]
            },
            ...
        ]
    }
}

 

Payload parameters

Parameter Description Type
duration Number in milliseconds to determine how long the caption should be displayed on the screen. number
delay The amount of time that should pass before this frame is shown on the screen. number
captionLines Array of captionLines objects that represent caption lines. array
captionLines.text Caption line text content. string
captionLines.styles Array of captionLines styles objects. array
captionLines.styles.charIndex Caption content index to apply activeStyle to. string
captionLines.styles.activeStyle Caption styles to apply. object
captionLines.styles.activeStyle.bold Indicates whether to apply bold. Boolean
captionLines.styles.activeStyle.italic Indicates whether to apply italics. Boolean
captionLines.styles.activeStyle.underline Indicates whether to apply underline. Boolean

setCaptionsState

The Alexa client sends this directive in response to the captionsStateRequest event to inform the IPC client of the current state of the captions setting in the Alexa client.

Example message

{
    "header": {
        "version": 1
        "namespace": "AlexaCaptions",
        "name": "setCaptionsState"
    },
    "payload": {
        "enabled": {{BOOLEAN}}
    }
}
 

Payload parameters

Parameter Description Type
enabled Indicates if captions are currently enabled in the Alexa client. Boolean

Events

Inbound messages from the IPC client about the display of Alexa captions.

captionsStateChanged

Send this event to instruct the Alexa client to change the AlexaCaptions setting state.

Example message

{
    "header": {
        "version": 1
        "namespace": "AlexaCaptions",
        "name": "captionsStateChanged"
    },
    "payload": {
        "enabled": {{BOOLEAN}}
    }
}
 

Payload parameters

Parameter Description Type
enabled Indicates whether to enable captions in the Alexa client. When true, the Alexa client sends the renderCaptions directive for Alexa responses supported by AlexaCaptions. Boolean

captionsStateRequest

Send this event to request the Alexa client to return the current state of the captions setting.

The Alexa client responds with a setCaptionsState directive.

Example message

{
    "header": {
        "version": 1
        "namespace": "AlexaCaptions",
        "name": "captionsStateRequest"
    },
    "payload": {}
}

Payload parameters

The payload is an empty object.