Accessibility

    Accessibility


    Article summary


    title: Accessibility

    version: 1.2.0
    layout: default
    sdk: core

    # Accessibility Module


    Version Accessibility 1.2.0

    Table of Contents

    Usage

    To use the Accessibility module, you can import it into your project from the Firebolt SDK:

    import { Accessibility } from '@firebolt-js/sdk'
    

    Overview

    The Accessibility module provides access to the user/device settings for closed captioning and voice guidance.

    Apps SHOULD attempt o respect these settings, rather than manage and persist seprate settings, which would be different per-app.

    Methods

    audioDescriptionSettings

    Get the user's preferred audio description settings

    To get the value of audioDescriptionSettings call the method like this:

    function audioDescriptionSettings(): Promise<AudioDescriptionSettings>
    

    Promise resolution:

    AudioDescriptionSettings

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:accessibility:audiodescriptions

    Examples

    Getting the audio description settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let settings = await Accessibility.audioDescriptionSettings()
    console.log(settings)
    

    Value of settings:

    {
    	"enabled": true
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.audioDescriptionSettings",
      "params": {}
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true
      }
    }
    

    To subscribe to notifications when the value changes, call the method like this:

    function audioDescriptionSettings(
      callback: (value) => AudioDescriptionSettings,
    ): Promise<number>
    

    Promise resolution:

    number
    

    Examples

    Getting the audio description settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let listenerId = await audioDescriptionSettings((value) => {
      console.log(value)
    })
    console.log(listenerId)
    

    Value of settings:

    {
    	"enabled": true
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.onAudioDescriptionSettingsChanged",
      "params": {
        "listen": true
      }
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true
      }
    }
    

    closedCaptions

    Get the user's preferred closed-captions settings

    function closedCaptions(): Promise<ClosedCaptionsSettings>
    

    Promise resolution:

    ClosedCaptionsSettings

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:accessibility:closedcaptions

    Examples

    Getting the closed captions settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let closedCaptionsSettings = await Accessibility.closedCaptions()
    console.log(closedCaptionsSettings)
    

    Value of closedCaptionsSettings:

    {
    	"enabled": true,
    	"styles": {
    		"fontFamily": "monospaced_sanserif",
    		"fontSize": 1,
    		"fontColor": "#ffffff",
    		"fontEdge": "none",
    		"fontEdgeColor": "#7F7F7F",
    		"fontOpacity": 100,
    		"backgroundColor": "#000000",
    		"backgroundOpacity": 100,
    		"textAlign": "center",
    		"textAlignVertical": "middle",
    		"windowColor": "white",
    		"windowOpacity": 50
    	},
    	"preferredLanguages": [
    		"eng",
    		"spa"
    	]
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.closedCaptions",
      "params": {}
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true,
        "styles": {
          "fontFamily": "monospaced_sanserif",
          "fontSize": 1,
          "fontColor": "#ffffff",
          "fontEdge": "none",
          "fontEdgeColor": "#7F7F7F",
          "fontOpacity": 100,
          "backgroundColor": "#000000",
          "backgroundOpacity": 100,
          "textAlign": "center",
          "textAlignVertical": "middle",
          "windowColor": "white",
          "windowOpacity": 50
        },
        "preferredLanguages": ["eng", "spa"]
      }
    }
    

    closedCaptionsSettings

    Get the user's preferred closed-captions settings

    To get the value of closedCaptionsSettings call the method like this:

    function closedCaptionsSettings(): Promise<ClosedCaptionsSettings>
    

    Promise resolution:

    ClosedCaptionsSettings

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:accessibility:closedcaptions

    Examples

    Getting the closed captions settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let closedCaptionsSettings = await Accessibility.closedCaptionsSettings()
    console.log(closedCaptionsSettings)
    

    Value of closedCaptionsSettings:

    {
    	"enabled": true,
    	"styles": {
    		"fontFamily": "monospaced_sanserif",
    		"fontSize": 1,
    		"fontColor": "#ffffff",
    		"fontEdge": "none",
    		"fontEdgeColor": "#7F7F7F",
    		"fontOpacity": 100,
    		"backgroundColor": "#000000",
    		"backgroundOpacity": 100,
    		"textAlign": "center",
    		"textAlignVertical": "middle",
    		"windowColor": "white",
    		"windowOpacity": 50
    	},
    	"preferredLanguages": [
    		"eng",
    		"spa"
    	]
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.closedCaptionsSettings",
      "params": {}
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true,
        "styles": {
          "fontFamily": "monospaced_sanserif",
          "fontSize": 1,
          "fontColor": "#ffffff",
          "fontEdge": "none",
          "fontEdgeColor": "#7F7F7F",
          "fontOpacity": 100,
          "backgroundColor": "#000000",
          "backgroundOpacity": 100,
          "textAlign": "center",
          "textAlignVertical": "middle",
          "windowColor": "white",
          "windowOpacity": 50
        },
        "preferredLanguages": ["eng", "spa"]
      }
    }
    

    To subscribe to notifications when the value changes, call the method like this:

    function closedCaptionsSettings(
      callback: (value) => ClosedCaptionsSettings,
    ): Promise<number>
    

    Promise resolution:

    number
    

    Examples

    Getting the closed captions settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let listenerId = await closedCaptionsSettings((value) => {
      console.log(value)
    })
    console.log(listenerId)
    

    Value of closedCaptionsSettings:

    {
    	"enabled": true,
    	"styles": {
    		"fontFamily": "monospaced_sanserif",
    		"fontSize": 1,
    		"fontColor": "#ffffff",
    		"fontEdge": "none",
    		"fontEdgeColor": "#7F7F7F",
    		"fontOpacity": 100,
    		"backgroundColor": "#000000",
    		"backgroundOpacity": 100,
    		"textAlign": "center",
    		"textAlignVertical": "middle",
    		"windowColor": "white",
    		"windowOpacity": 50
    	},
    	"preferredLanguages": [
    		"eng",
    		"spa"
    	]
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.onClosedCaptionsSettingsChanged",
      "params": {
        "listen": true
      }
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true,
        "styles": {
          "fontFamily": "monospaced_sanserif",
          "fontSize": 1,
          "fontColor": "#ffffff",
          "fontEdge": "none",
          "fontEdgeColor": "#7F7F7F",
          "fontOpacity": 100,
          "backgroundColor": "#000000",
          "backgroundOpacity": 100,
          "textAlign": "center",
          "textAlignVertical": "middle",
          "windowColor": "white",
          "windowOpacity": 50
        },
        "preferredLanguages": ["eng", "spa"]
      }
    }
    

    listen

    To listen to a specific event pass the event name as the first parameter:

    listen(event: string, callback: (data: any) => void): Promise<number>
    

    Parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event to listen for, see Events.
    callbackfunctionYesA function that will be invoked when the event occurs.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. Accessibility.clear(id)

    Callback parameters:

    ParamTypeRequiredSummary
    dataanyYesThe event data, which depends on which event is firing, see Events.

    To listen to all events from this module pass only a callback, without specifying an event name:

    listen(callback: (event: string, data: any) => void): Promise<number>
    

    Parameters:

    ParamTypeRequiredSummary
    callbackfunctionYesA function that will be invoked when the event occurs. The event data depends on which event is firing, see Events.

    Callback parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event that has occured listen for, see Events.
    dataanyYesThe event data, which depends on which event is firing, see Events.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. Accessibility.clear(id)

    See Listening for events for more information and examples.

    once

    To listen to a single instance of a specific event pass the event name as the first parameter:

    once(event: string, callback: (data: any) => void): Promise<number>
    

    The once method will only pass the next instance of this event, and then dicard the listener you provided.

    Parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event to listen for, see Events.
    callbackfunctionYesA function that will be invoked when the event occurs.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. Accessibility.clear(id)

    Callback parameters:

    ParamTypeRequiredSummary
    dataanyYesThe event data, which depends on which event is firing, see Events.

    To listen to the next instance only of any events from this module pass only a callback, without specifying an event name:

    once(callback: (event: string, data: any) => void): Promise<number>
    

    Parameters:

    ParamTypeRequiredSummary
    callbackfunctionYesA function that will be invoked when the event occurs. The event data depends on which event is firing, see Events.

    Callback parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event that has occured listen for, see Events.
    dataanyYesThe event data, which depends on which event is firing, see Events.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. Accessibility.clear(id)

    See Listening for events for more information and examples.

    voiceGuidance

    Get the user's preferred voice guidance settings

    function voiceGuidance(): Promise<VoiceGuidanceSettings>
    

    Promise resolution:

    VoiceGuidanceSettings

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:accessibility:voiceguidance

    Examples

    Getting the voice guidance settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let settings = await Accessibility.voiceGuidance()
    console.log(settings)
    

    Value of settings:

    {
    	"enabled": true,
    	"speed": 2
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.voiceGuidance",
      "params": {}
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true,
        "speed": 2
      }
    }
    

    voiceGuidanceSettings

    Get the user's preferred voice guidance settings

    To get the value of voiceGuidanceSettings call the method like this:

    function voiceGuidanceSettings(): Promise<VoiceGuidanceSettings>
    

    Promise resolution:

    VoiceGuidanceSettings

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:accessibility:voiceguidance

    Examples

    Getting the voice guidance settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let settings = await Accessibility.voiceGuidanceSettings()
    console.log(settings)
    

    Value of settings:

    {
    	"enabled": true,
    	"speed": 2
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.voiceGuidanceSettings",
      "params": {}
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true,
        "speed": 2
      }
    }
    

    To subscribe to notifications when the value changes, call the method like this:

    function voiceGuidanceSettings(
      callback: (value) => VoiceGuidanceSettings,
    ): Promise<number>
    

    Promise resolution:

    number
    

    Examples

    Getting the voice guidance settings

    JavaScript:

    import { Accessibility } from '@firebolt-js/sdk'
    
    let listenerId = await voiceGuidanceSettings((value) => {
      console.log(value)
    })
    console.log(listenerId)
    

    Value of settings:

    {
    	"enabled": true,
    	"speed": 2
    }
    
    JSON-RPC:Request:
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "Accessibility.onVoiceGuidanceSettingsChanged",
      "params": {
        "listen": true
      }
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": {
        "enabled": true,
        "speed": 2
      }
    }
    

    Events

    audioDescriptionSettingsChanged

    See: audioDescriptionSettings

    closedCaptionsSettingsChanged

    See: closedCaptionsSettings

    voiceGuidanceSettingsChanged

    See: voiceGuidanceSettings

    Types

    AudioDescriptionSettings

    type AudioDescriptionSettings = {
      enabled: boolean // Whether or not audio descriptions should be enabled by default
    }
    


    Was this article helpful?

    What's Next