Skip to content

ClosedCaptions

LaCivita, Jeremy edited this page May 26, 2022 · 1 revision

Version The Firebolt JS Manage SDK [Alpha 4]

Overview

A module for managing closed-captions Settings.

OpenRPC

Firebolt APIs are maintained in the rdkcentral/firebolt-manage-sdk.git GitHub repository.

You can see this API in the closedcaptions.json OpenRPC JSON-Schema document.

Table of Contents

Usage

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

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

Methods

backgroundColor

The prefered background color for displaying closed-captions, .

To get the value, call the method with no parameters:

function backgroundColor(): Promise<Color>

Promise resolution:

Type Description
Color

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.backgroundColor()
    .then(color => {
        console.log(color)
    })

Value of color:

"#000000"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.backgroundColor",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "#000000"
}

To set the value, pass in the new value as the only parameter:

function backgroundColor(value: Color): Promise<void>

Parameters:

Param Type Required Summary
value Color true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.backgroundColor("#000000")
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setBackgroundColor",
  "params": {
    "value": "#000000"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function backgroundColor(subscriber: (color: Color) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for backgroundColor changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
color Color Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.backgroundColor(color => {
  // property value was changed
  console.log(color)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of color:

"#000000"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onBackgroundColorChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "#000000"
}

backgroundOpacity

The prefered opacity for displaying closed-captions backgrounds.

To get the value, call the method with no parameters:

function backgroundOpacity(): Promise<Opacity>

Promise resolution:

Type Description
Opacity

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.backgroundOpacity()
    .then(opacity => {
        console.log(opacity)
    })

Value of opacity:

100
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.backgroundOpacity",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 100
}

To set the value, pass in the new value as the only parameter:

function backgroundOpacity(value: Opacity): Promise<void>

Parameters:

Param Type Required Summary
value Opacity true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.backgroundOpacity(100)
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setBackgroundOpacity",
  "params": {
    "value": 100
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function backgroundOpacity(subscriber: (opacity: Opacity) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for backgroundOpacity changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
opacity Opacity Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.backgroundOpacity(opacity => {
  // property value was changed
  console.log(opacity)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of opacity:

100
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onBackgroundOpacityChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 100
}

enabled

Whether or not closed-captions are enabled.

To get the value, call the method with no parameters:

function enabled(): Promise<boolean>

Promise resolution:

Type Description
boolean

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.enabled()
    .then(enabled => {
        console.log(enabled)
    })

Value of enabled:

true
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.enabled",
  "params": {}
}

Response:

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

To set the value, pass in the new value as the only parameter:

function enabled(value: boolean): Promise<void>

Parameters:

Param Type Required Summary
value boolean true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.enabled(true)
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setEnabled",
  "params": {
    "value": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function enabled(subscriber: (enabled: boolean) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for enabled changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
enabled boolean Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.enabled(enabled => {
  // property value was changed
  console.log(enabled)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of enabled:

true
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onEnabledChanged",
  "params": {
    "listen": true
  }
}

Response:

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

fontColor

The prefered font color for displaying closed-captions.

To get the value, call the method with no parameters:

function fontColor(): Promise<Color>

Promise resolution:

Type Description
Color

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontColor()
    .then(color => {
        console.log(color)
    })

Value of color:

"#ffffff"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.fontColor",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "#ffffff"
}

To set the value, pass in the new value as the only parameter:

function fontColor(value: Color): Promise<void>

Parameters:

Param Type Required Summary
value Color true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontColor("#ffffff")
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setFontColor",
  "params": {
    "value": "#ffffff"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function fontColor(subscriber: (color: Color) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for fontColor changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
color Color Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontColor(color => {
  // property value was changed
  console.log(color)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of color:

"#ffffff"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onFontColorChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "#ffffff"
}

fontEdge

The prefered font edge style for displaying closed-captions.

To get the value, call the method with no parameters:

function fontEdge(): Promise<FontEdge>

Promise resolution:

Type Description
FontEdge

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontEdge()
    .then(edge => {
        console.log(edge)
    })

Value of edge:

"none"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.fontEdge",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "none"
}

To set the value, pass in the new value as the only parameter:

function fontEdge(value: FontEdge): Promise<void>

Parameters:

Param Type Required Summary
value FontEdge true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontEdge("none")
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setFontEdge",
  "params": {
    "value": "none"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function fontEdge(subscriber: (edge: FontEdge) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for fontEdge changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
edge FontEdge Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontEdge(edge => {
  // property value was changed
  console.log(edge)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of edge:

"none"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onFontEdgeChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "none"
}

fontEdgeColor

The prefered font edge color for displaying closed-captions.

To get the value, call the method with no parameters:

function fontEdgeColor(): Promise<Color>

Promise resolution:

Type Description
Color

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontEdgeColor()
    .then(color => {
        console.log(color)
    })

Value of color:

"#000000"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.fontEdgeColor",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "#000000"
}

To set the value, pass in the new value as the only parameter:

function fontEdgeColor(value: Color): Promise<void>

Parameters:

Param Type Required Summary
value Color true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontEdgeColor("#000000")
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setFontEdgeColor",
  "params": {
    "value": "#000000"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function fontEdgeColor(subscriber: (color: Color) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for fontEdgeColor changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
color Color Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontEdgeColor(color => {
  // property value was changed
  console.log(color)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of color:

"#000000"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onFontEdgeColorChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "#000000"
}

fontFamily

The prefered font family for displaying closed-captions.

To get the value, call the method with no parameters:

function fontFamily(): Promise<FontFamily>

Promise resolution:

Type Description
FontFamily

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontFamily()
    .then(family => {
        console.log(family)
    })

Value of family:

"Monospace sans-serif"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.fontFamily",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Monospace sans-serif"
}

To set the value, pass in the new value as the only parameter:

function fontFamily(value: FontFamily): Promise<void>

Parameters:

Param Type Required Summary
value FontFamily true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontFamily("Monospace sans-serif")
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setFontFamily",
  "params": {
    "value": "Monospace sans-serif"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function fontFamily(subscriber: (family: FontFamily) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for fontFamily changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
family FontFamily Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontFamily(family => {
  // property value was changed
  console.log(family)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of family:

"Monospace sans-serif"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onFontFamilyChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Monospace sans-serif"
}

fontOpacity

The prefered opacity for displaying closed-captions characters.

To get the value, call the method with no parameters:

function fontOpacity(): Promise<Opacity>

Promise resolution:

Type Description
Opacity

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontOpacity()
    .then(opacity => {
        console.log(opacity)
    })

Value of opacity:

100
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.fontOpacity",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 100
}

To set the value, pass in the new value as the only parameter:

function fontOpacity(value: Opacity): Promise<void>

Parameters:

Param Type Required Summary
value Opacity true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontOpacity(100)
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setFontOpacity",
  "params": {
    "value": 100
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function fontOpacity(subscriber: (opacity: Opacity) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for fontOpacity changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
opacity Opacity Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontOpacity(opacity => {
  // property value was changed
  console.log(opacity)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of opacity:

100
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onFontOpacityChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 100
}

fontSize

The prefered font size for displaying closed-captions.

To get the value, call the method with no parameters:

function fontSize(): Promise<FontSize>

Promise resolution:

Type Description
FontSize

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontSize()
    .then(size => {
        console.log(size)
    })

Value of size:

1
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.fontSize",
  "params": {}
}

Response:

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

To set the value, pass in the new value as the only parameter:

function fontSize(value: FontSize): Promise<void>

Parameters:

Param Type Required Summary
value FontSize true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontSize(1)
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setFontSize",
  "params": {
    "value": 1
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function fontSize(subscriber: (size: FontSize) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for fontSize changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
size FontSize Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.fontSize(size => {
  // property value was changed
  console.log(size)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of size:

1
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onFontSizeChanged",
  "params": {
    "listen": true
  }
}

Response:

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

listen

Listen for events from this module.

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

ClosedCaptions.listen(event: string, (data: any) => void): Promise<bigint>

Parameters:

Param Type Required Summary
event string Yes The event to listen for, see Events.
callback function Yes A function that will be invoked when the event occurs.

Promise resolution:

Type Description
bigint Listener ID to clear the callback method and stop receiving the event, e.g. ClosedCaptions.clear(id)

Callback parameters:

Param Type Required Summary
data any Yes The 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:

ClosedCaptions.listen((event: string, data: any) => void): Promise<bigint>

Parameters:

Param Type Required Summary
callback function Yes A function that will be invoked when the event occurs. The event data depends on which event is firing, see Events.

Callback parameters:

Param Type Required Summary
event string Yes The event that has occured listen for, see Events.
data any Yes The event data, which depends on which event is firing, see Events.

Promise resolution:

Type Description
bigint Listener ID to clear the callback method and stop receiving the event, e.g. ClosedCaptions.clear(id)

See Listening for events for more information and examples.


once

Listen for only one occurance of an event from this module. The callback will be cleared after one event.

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

ClosedCaptions.once(event: string, (data: any) => void): Promise<bigint>

Parameters:

Param Type Required Summary
event string Yes The event to listen for, see Events.
callback function Yes A function that will be invoked when the event occurs.

Promise resolution:

Type Description
bigint Listener ID to clear the callback method and stop receiving the event, e.g. ClosedCaptions.clear(id)

Callback parameters:

Param Type Required Summary
data any Yes The 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:

ClosedCaptions.once((event: string, data: any) => void): Promise<bigint>

Parameters:

Param Type Required Summary
callback function Yes A function that will be invoked when the event occurs. The event data depends on which event is firing, see Events.

Callback parameters:

Param Type Required Summary
event string Yes The event that has occured listen for, see Events.
data any Yes The event data, which depends on which event is firing, see Events.

Promise resolution:

Type Description
bigint Listener ID to clear the callback method and stop receiving the event, e.g. ClosedCaptions.clear(id)

See Listening for events for more information and examples.


provide

Register to provide a capability from this module.

See Provider Interfaces, for more info.

function provide(provider: object | class): Promise<void>

Parameters:

Param Type Required Summary
provider `object class` true

Promise resolution:

void

textAlign

The prefered horizontal alignment for displaying closed-captions characters.

To get the value, call the method with no parameters:

function textAlign(): Promise<HorizontalAlignment>

Promise resolution:

Type Description
HorizontalAlignment

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.textAlign()
    .then(opacity => {
        console.log(opacity)
    })

Value of opacity:

"center"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.textAlign",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "center"
}

To set the value, pass in the new value as the only parameter:

function textAlign(value: HorizontalAlignment): Promise<void>

Parameters:

Param Type Required Summary
value HorizontalAlignment true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.textAlign("center")
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setTextAlign",
  "params": {
    "value": "center"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function textAlign(subscriber: (opacity: HorizontalAlignment) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for textAlign changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
opacity HorizontalAlignment Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.textAlign(opacity => {
  // property value was changed
  console.log(opacity)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of opacity:

"center"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onTextAlignChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "center"
}

textAlignVertical

The prefered horizontal alignment for displaying closed-captions characters.

To get the value, call the method with no parameters:

function textAlignVertical(): Promise<VerticalAlignment>

Promise resolution:

Type Description
VerticalAlignment

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.textAlignVertical()
    .then(opacity => {
        console.log(opacity)
    })

Value of opacity:

"middle"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.textAlignVertical",
  "params": {}
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "middle"
}

To set the value, pass in the new value as the only parameter:

function textAlignVertical(value: VerticalAlignment): Promise<void>

Parameters:

Param Type Required Summary
value VerticalAlignment true

Promise resolution:

Type Summary
void Promise resolves with no value when the operation is complete.

Examples

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.textAlignVertical("middle")
    .then(response => {
        // property value has been set
    })
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.setTextAlignVertical",
  "params": {
    "value": "middle"
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}

To subscribe to notifications when the value changes, pass a function as the only parameter:

function textAlignVertical(subscriber: (opacity: VerticalAlignment) => void): Promise<boolean>

Parameters:

Param Type Required Summary
subscriber Function Yes A callback that gets invoked when the value for textAlignVertical changes

Promise resolution:

Type Summary
listenerId The id of the listener that can be used with ClosedCaptions.clear(listenerId) to unsubscribe

Callback parameters:

Param Type Required Summary
opacity VerticalAlignment Yes

Examples

Default Example

JavaScript:

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

ClosedCaptions.textAlignVertical(opacity => {
  // property value was changed
  console.log(opacity)
}).then(listenerId => {
  // you can clear this listener w/ ClosedCaptions.clear(listenerId)
})

value of opacity:

"middle"
JSON-RPC:

Request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "closedcaptions.onTextAlignVerticalChanged",
  "params": {
    "listen": true
  }
}

Response:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "listening": "true"
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "middle"
}

Additional methods

The following methods are documented as part of a related set of method APIs.

For more information, follow the links under the "Documentation" column.

JavaScript RPC Parameters Documentation
NA setEnabled (enabled?: boolean) enabled
NA setFontFamily (family?: FontFamily) fontFamily
NA setFontSize (size?: FontSize) fontSize
NA setFontColor (color?: Color) fontColor
NA setFontEdge (edge?: FontEdge) fontEdge
NA setFontEdgeColor (color?: Color) fontEdgeColor
NA setFontOpacity (opacity?: Opacity) fontOpacity
NA setBackgroundColor (color?: Color) backgroundColor
NA setBackgroundOpacity (opacity?: Opacity) backgroundOpacity
NA setTextAlign (opacity?: HorizontalAlignment) textAlign
NA setTextAlignVertical (opacity?: VerticalAlignment) textAlignVertical
NA settingsResponse (response: ProviderResponse) SettingsProvider

Events

Additional events

The following events are documented as part of a related set of method APIs.

For more information, follow the links under the "Documentation" column.

JavaScript RPC Payload Documentation
NA onRequestSettings ClosedCaptionsSettingsProviderRequest
enabledChanged onEnabledChanged boolean enabled
fontFamilyChanged onFontFamilyChanged FontFamily fontFamily
fontSizeChanged onFontSizeChanged FontSize fontSize
fontColorChanged onFontColorChanged Color fontColor
fontEdgeChanged onFontEdgeChanged FontEdge fontEdge
fontEdgeColorChanged onFontEdgeColorChanged Color fontEdgeColor
fontOpacityChanged onFontOpacityChanged Opacity fontOpacity
backgroundColorChanged onBackgroundColorChanged Color backgroundColor
backgroundOpacityChanged onBackgroundOpacityChanged Opacity backgroundOpacity
textAlignChanged onTextAlignChanged HorizontalAlignment textAlign
textAlignVerticalChanged onTextAlignVerticalChanged VerticalAlignment textAlignVertical

Provider Interfaces

Providers are interfaces that your app can implement in order to provide certain capabilties back to the platform.

To register a provider, use the provide() method.

Every provider interface method has the following signature:

(parameters: object | void, session: ProviderSession) => {}

ProviderSession has the following interface:

interface ProviderSession {
    correlationId(): string        // Returns the correlation id of the current provider session
}

SettingsProvider

The provider interface for the xrn:firebolt:capability:settings:closedcaptions capability.

interface SettingsProvider {
	settings(parameters?: object, session?: ProviderSession): Promise<ClosedCaptionsSettings>
}

Usage:

ClosedCaptions.provide('xrn:firebolt:capability:settings:closedcaptions', provider: SettingsProvider | object)

settings

Dispatches a request for the current closed-captions settings to the closed-captions settings provider.

function settings(parameters?: object, session?: ProviderSession): Promise<ClosedCaptionsSettings>

Provider methods always have two arguments:

Param Type Required Summary
parameters object false
session ProviderSession false

Promise resolution:

Type Description
ClosedCaptionsSettings

Examples

Register your app to provide the xrn:firebolt:capability:settings:closedcaptions capability.

import { ClosedCaptions } from '@firebolt-js/manage-sdk'

class MySettingsProvider {

    async settings(parameters, session) {
        return await Promise.resolve({
            "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"
            }
        })
    }

}

ClosedCaptions.provide('xrn:firebolt:capability:settings:closedcaptions', new MySettingsProvider())
**JSON-RPC**

Register to recieve each provider API

Request:

{
    "id": 1,
    "method": "onRequestSettings",
    "params": {
        "listen": true
    }
}

Response:

{
    "id": 1,
    "result": {
        "listening": true,
        "event": "ClosedCaptions.onRequestSettings"
    }            
 
}

Asynchronous event to initiate settings()

Event Response:

{
    "id": 1,
    "result": {
        "correlationId": "123",
        "parameters": null
    }
}

App initiated response to event

Request:

{
    "id": 2,
    "method": "settingsResponse",
    "params": {
        "response": {
            "correlationId": "123",
            "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"
                }
            }
        }
    }
}

Response:

{
    "id": 2,
    "result": true
}

Schemas

ClosedCaptionsSettingsProviderRequest

type ClosedCaptionsSettingsProviderRequest = {
  correlationId: string                         // The id that was passed in to the event that triggered a provider method to be called
  parameters?: null
}

See also: