Accessibility (Roku)
Below a description of some of the features supported from Diva Roku version 5.3.
Text To Speech (Voice Over)​
Diva Roku supports Text to speech (TTS) which allows the developer to provide an audible spoken version of the strings shown to the user in the channel. The Roku text to speech capability supports different languages, voices, rates of speech, volume of speech, and other aspects of text to speech.
This feature is only available on the following devices: Roku Streaming Stick (3600X), Roku Express (3700X) and Express+ (3710X), Roku Premiere (4620X) and Premiere+ (4630X), Roku Ultra (4640X), and any Roku TV running Roku OS 7.2 and later.
Many native Roku SceneGraph nodes support TTS by default with some special behaviour, for example:
- Button: text of button is spoken only if focused
- Label: speaks text field
- Poster: if focused, speaks audioGuideText field (if set)
- ScrollableText: speaks text field
- PinPad: speaks focused key and many others
For custom component implementation developer can use utils function
sub say(text as string, flushSpeech = true as boolean, dontRepeat = false as boolean)
textToSpeechNode = getTextToSpeech()
textToSpeechNode.say(text, flushSpeech, dontRepeat)
end sub
See more on Use VoiceOver on Roku.
Disable transparency & Closed Captions Enhancements​
To provide better accessibility to menu and user interfaces, DIVA provide also other functionalities: closed captions enhacements (closed captions in high-contrast and enlarged) and transparency disabled.
The features enabled directly by the user unless the feature is disable.
Property | Description | Type | default |
---|---|---|---|
darkerBackgroundCc | starting value for closed captions high-contrast | boolean | false |
enlargedCcs | starting value for closed captions enlarged | boolean | false |
opaqueBackground | starting value for disable transparency on menu | boolean | false |
ccEnhancementsOptionEnabled | enable cc enhancements (darkerBackgroundCc , enlargedCcs ) and enable the possibility to have this accessibility feature to be updated by the user | boolean | false |
transparencyOptionEnabled | enable opaqueBackground and enable the possibility to have this accessibility feature to be updated by the user | boolean | false |
Integrator can setup accessibility parameters in player launch parameters method and listen to user actions with observeDivaPlayerAccessibilityUpdateEvent method as subscription to accessibility settings updates
sub launchDivaPlayer()
divaPlayer = getDivaPlayer()
...
setDivaPlayerLaunchParams(prepareLaunchParams())
...
observeDivaPlayerAccessibilityUpdateEvent("onAccessibilityUpdateEventHandler")
...
runDivaPlayer()
end sub
setDivaPlayerLaunchParams({
...
darkerBackgroundCc: true
enlargedCc: false
opaqueBackground: false
ccEnhancementsOptionEnabled: false
transparencyOptionEnabled: false
...
})
sub onAccessibilityUpdateEventHandler(evt as dynamic)
data = evt.getData()
if (data <> invalid)
if (data.darkerBackgroundCc <> invalid)
...
end if
if (data.enlargedCc <> invalid)
...
end if
if (data.opaqueBackground <> invalid)
...
end if
end if
end sub
Voice Controls​
Voice controls enable channels to handle commands from the Roku voice remote and Roku mobile app to control the playback of content and select a user from a profile screen.
With voice controls, Roku channel can respond to the following types of voice commands to control the playback of content:
Basic commands​
Simple commands for controlling content playback such as "fast forward", "rewind", "pause", "resume", and "replay".
Enhanced commands​
Advanced commands for controlling content playback and content in playlists such as "rewind 30 seconds" and "forward 10 minutes" (referred to as "seek" commands), "start over", and "next" (for playing the next video clip in a playlist).
Additional enhanced commands​
Additional enhanced commands for showing channel metadata, controlling the playback order of content in playlists, and rating content. This includes commands as "what's playing" to display the title of the content currently in playback (referred to as "nowplaying"), "skip intro"/"skip recap" to skip the current section being played (referred to as "skip"), "shuffle" to randomly select content in a playlist (is not supported in Diva player), "loop" to repeat the content in a playlist(is not supported in Diva player), and "like"/"dislike" to rate content(are not supported in Diva player).
' Input Task for Voice Commands handling instantiation
globalFields[m.gfc["DIVA_INPUT_TASK"]] = CreateObject("roSGNode", "InputTask")
' Input Task main cycle for managing 'transport' events
sub init()
m.top.functionName = "inputHandler"
end sub
sub inputHandler()
port = createObject("roMessagePort")
roInput = createObject("roInput")
roInput.setMessagePort(port)
roInput.enableTransportEvents()
while true
msg = port.waitMessage(500)
if type(msg) = "roInputEvent"
if msg.isInput()
data = msg.getInfo()
if data.type = "transport"
m.top.voiceCommandData = data
end if
end if
end if
...
end while
end sub
' such function is handling voice commands in many player places
sub handleVoiceCommand(evt as dynamic)
data = evt.getData()
voiceCommand = getVoiceCommand()
status = "unhandled"
if voiceCommand <> "" and not m.isSettingsOpened()
if voiceCommand = "pause" or voiceCommand = "stop"
...
else if voiceCommand = "play" or voiceCommand = "resume"
...
end if
end if
m.divaEventBus.voiceCommandResponse = {id: data.id, status: status}
end sub