Accessibility Module
Version 0.6.0
OpenRPC
This document was generated from an OpenRPC JSON-Schema, and is intended to provide a human readable overview and examples of the methods contained in the module.
For the full schema, see the link below.
Schema |
---|
accessibility.json |
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.
Events
Methods
closedCaptions
Get the user's preferred closed-captions settings
function closedCaptions(): Promise<ClosedCaptionsSettings>
Promise Resolution
Type | Description |
---|---|
ClosedCaptionsSettings | the closed captions settings |
Examples
Getting the closed captions settings
JavaScript
import { Accessibility } from '@firebolt-js/sdk'
Accessibility.closedCaptions()
.then(closedCaptionsSettings => {
console.log(closedCaptionsSettings)
})
Value of closedCaptionsSettings
{
"enabled": true,
"styles": {
"fontFamily": "Monospace sans-serif",
"fontSize": 1,
"fontColor": "#ffffff",
"fontEdge": "none",
"fontEdgeColor": "#7F7F7F",
"fontOpacity": 100,
"backgroundColor": "#000000",
"backgroundOpacity": 100,
"textAlign": "center",
"textAlignVertical": "middle"
}
}
JSON-RPC
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "accessibility.closedCaptions",
"params": {}
}
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"enabled": true,
"styles": {
"fontFamily": "Monospace sans-serif",
"fontSize": 1,
"fontColor": "#ffffff",
"fontEdge": "none",
"fontEdgeColor": "#7F7F7F",
"fontOpacity": 100,
"backgroundColor": "#000000",
"backgroundOpacity": 100,
"textAlign": "center",
"textAlignVertical": "middle"
}
}
}
closedCaptionsSettings
Get the user's preferred closed-captions settings
To get the property value, use closedCaptionsSettings()
:
function closedCaptionsSettings(): Promise<ClosedCaptionsSettings>
Parameters
Param | Type | Required | Summary |
---|
Promise Resolution
Type | Summary |
---|---|
ClosedCaptionsSettings | the closed captions settings |
Examples
Getting the closed captions settings
JavaScript
import { Accessibility } from '@firebolt-js/sdk'
Accessibility.closedCaptionsSettings()
.then(closedCaptionsSettings => {
console.log(closedCaptionsSettings)
})
Value of value
{
"enabled": true,
"styles": {
"fontFamily": "Monospace sans-serif",
"fontSize": 1,
"fontColor": "#ffffff",
"fontEdge": "none",
"fontEdgeColor": "#7F7F7F",
"fontOpacity": 100,
"backgroundColor": "#000000",
"backgroundOpacity": 100,
"textAlign": "center",
"textAlignVertical": "middle"
}
}
JSON-RPC
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "accessibility.closedCaptionsSettings",
"params": {}
}
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"enabled": true,
"styles": {
"fontFamily": "Monospace sans-serif",
"fontSize": 1,
"fontColor": "#ffffff",
"fontEdge": "none",
"fontEdgeColor": "#7F7F7F",
"fontOpacity": 100,
"backgroundColor": "#000000",
"backgroundOpacity": 100,
"textAlign": "center",
"textAlignVertical": "middle"
}
}
}
To subscribe to the property value, use closedCaptionsSettings(value => { })
:
function closedCaptionsSettings(callback: (closedCaptionsSettings: ClosedCaptionsSettings) => any): Promise<boolean>
Parameters
Param | Type | Required | Summary |
---|---|---|---|
callback | function | Yes | A callback that gets invoked when the value for closedCaptionsSettings changes |
Promise Resolution
Type | Summary |
---|---|
listenerId | The id of the listener that can be used with Accessibility.clear(listenerId) to unsubscribe |
Callback Parameters
Param | Type | Required | Summary |
---|---|---|---|
closedCaptionsSettings | ClosedCaptionsSettings | true | the closed captions settings |
Examples
Getting the closed captions settings
JavaScript
Accessibility.closedCaptionsSettings(value => {
console.log(value)
}).then(response => {
console.log(response)
})
Value of response
{}
Value of value
{
"enabled": true,
"styles": {
"fontFamily": "Monospace sans-serif",
"fontSize": 1,
"fontColor": "#ffffff",
"fontEdge": "none",
"fontEdgeColor": "#7F7F7F",
"fontOpacity": 100,
"backgroundColor": "#000000",
"backgroundOpacity": 100,
"textAlign": "center",
"textAlignVertical": "middle"
}
}
JSON-RPC
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "accessibility.onClosedCaptionsSettingsChanged",
"params": {
"listen": true
}
}
Response
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"listening": "true"
}
}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"enabled": true,
"styles": {
"fontFamily": "Monospace sans-serif",
"fontSize": 1,
"fontColor": "#ffffff",
"fontEdge": "none",
"fontEdgeColor": "#7F7F7F",
"fontOpacity": 100,
"backgroundColor": "#000000",
"backgroundOpacity": 100,
"textAlign": "center",
"textAlignVertical": "middle"
}
}
}
voiceGuidance
Get the user's preferred voice guidance settings
function voiceGuidance(): Promise<VoiceGuidanceSettings>
Promise Resolution
Type | Description |
---|---|
VoiceGuidanceSettings | the voice guidance settings |
Examples
Getting the voice guidance settings
JavaScript
import { Accessibility } from '@firebolt-js/sdk'
Accessibility.voiceGuidance()
.then(settings => {
console.log(settings)
})
Value of settings
{
"enabled": true,
"speed": 5
}
JSON-RPC
voiceGuidanceSettings
Get the user's preferred voice guidance settings
To get the property value, use voiceGuidanceSettings()
:
function voiceGuidanceSettings(): Promise<VoiceGuidanceSettings>
Parameters
Param | Type | Required | Summary |
---|
Promise Resolution
Type | Summary |
---|---|
VoiceGuidanceSettings | the voice guidance settings |
Examples
Getting the voice guidance settings
JavaScript
import { Accessibility } from '@firebolt-js/sdk'
Accessibility.voiceGuidanceSettings()
.then(settings => {
console.log(settings)
})
Value of value
{
"enabled": true,
"speed": 5
}
JSON-RPC
To subscribe to the property value, use voiceGuidanceSettings(value => { })
:
function voiceGuidanceSettings(callback: (settings: VoiceGuidanceSettings) => any): Promise<boolean>
Parameters
Param | Type | Required | Summary |
---|---|---|---|
callback | function | Yes | A callback that gets invoked when the value for voiceGuidanceSettings changes |
Promise Resolution
Type | Summary |
---|---|
listenerId | The id of the listener that can be used with Accessibility.clear(listenerId) to unsubscribe |
Callback Parameters
Param | Type | Required | Summary |
---|---|---|---|
settings | VoiceGuidanceSettings | true | the voice guidance settings |
Examples
Getting the voice guidance settings
JavaScript
Accessibility.voiceGuidanceSettings(value => {
console.log(value)
}).then(response => {
console.log(response)
})
Value of response
{}
Value of value
{
"enabled": true,
"speed": 5
}
JSON-RPC
Schemas
ClosedCaptionsStyles
type ClosedCaptionsStyles = {
fontFamily?: string
fontSize?: number
fontColor?: string
fontEdge?: string
fontEdgeColor?: string
fontOpacity?: number
backgroundColor?: string
backgroundOpacity?: number
textAlign?: string
textAlignVertical?: string
}
Details
The default styles to use when displaying closed-captions
ClosedCaptionsSettings
type ClosedCaptionsSettings = {
enabled: boolean // Whether or not closed-captions should be enabled by default
styles: ClosedCaptionsStyles // The default styles to use when displaying closed-captions
}
VoiceGuidanceSettings
type VoiceGuidanceSettings = {
enabled: boolean // Whether or not voice guidance should be enabled by default
speed: number // The speed at which voice guidance speech will be read back to the user
}