Self Voicing API
Self Voicing Overview
Provides both a Text-To-Speech engine for vocalizing text and user interface for enabling/disabling (mute/unmute) the speech synthesis.
Note: This is will only work in browsers that support the SpeechSynthesis API
Join the infusion-users mailing list and ask your questions there.
Adding a Self Voicing Component
Option 1: Typically used as a sub-component of a Preferences Editor Loader, particularly the First Discovery Tool Editor.
Adding as a subcomponent:
selfVoicing: {
type: "gpii.firstDiscovery.selfVoicing",
container: "{that}.dom.selfVoicing",
options: {}
}Option 2: Adding as a stand alone component:
var mySelfVoicing = gpii.firstDiscovery.selfVoicing(container, options);Grades
The base grades used by the Self Voicing:
Model
Path | Description | Values | Default |
|---|---|---|---|
| The enabled/disabled (unmute/mute) state of the component | true/false ( | false |
| The utterance options to use for all utterances, unless overridden in | An object containing any of the following:
| {} |
Methods
Method | Description | Parameters |
|---|---|---|
| Makes use of the fluid.textToSpeech.queueSpeech but only calls it if the |
|
| Toggles the |
|
| Sets the mute button label depending on the |
|
| Sets the tooltip for the mute button depending on the |
|
| Sets the style class on the mute button depending on the |
|
| Empties the queue if the self voicing is disabled (muted). |
|
| Utters the current |
|
Options
Name | Description | Values | Default |
|---|---|---|---|
| Javascript object containing selectors for various fragments of the markup, including the containers for the subcomponents. |
|
See Selectors |
| Specific class names used to achieve the look and feel. |
| styles: {
muted: "gpii-fd-selfVoicing-muted",
unmuted: "gpii-fd-selfVoicing-unmuted"
} |
| The mapping between the selector and tooltip message to be displayed (see: Attach Tooltip API). |
| tooltipContentMap: {
"mute": "mutedTooltip"
} |
| JavaScript object containing model paths and the listeners that are activated when changes happen to those paths. | Keys in the object are event names, values are functions or arrays of functions. | See Model |
Selectors
One of the options that can be provided to the First Discovery Editor is a set of CSS-based selectors identifying where in the DOM different elements can be found. The value for the option is itself a Javascript object containing name/value pairs:
selectors: {
selector1Name: "selector 1 string",
selector2Name: "selector 2 string",
...
}Selector Name | Description | Default |
|---|---|---|
| The DOM element to use as the mute button | ".gpiic-fd-selfVoicing-mute" |
| The DOM element to use as the label for the mute button | ".gpiic-fd-selfVoicing-muteLabel" |
Dependencies
<script type="text/javascript" src="src/lib/infusion/infusion-custom.js"></script>
<script type="text/javascript" src="src/js/tooltip.js"></script>
<script type="text/javascript" src="src/js/msgLookup.js"></script>
<script type="text/javascript" src="src/js/selfVoicing.js"></script>