Text to Speech Module Reference

Table of contents


Introduction

The Text to Speech module contains an interface to the DOM or Cordova text-to-speech functions. WebApps will use the DOM, while native Cordova apps will use the Android or iOS native text-to-speech interface.


speech

Syntax

import {speech} from 'common/option/speech.js';

The speech object contains methods for the DOM text-to-speech functions.


speech methods

speech.isSpeak()

Syntax

ctxDraw.isSpeak()

Returns true if text-to-speech is available.

Return value

A Boolean.


speech.speak()

Syntax

ctxDraw.speak(text)
ctxDraw.speak(text, options)

Speaks the text on the device. The options argument can change the speech rate. The method returns a Promise that resolves when the speech is completed. It's up to the caller add delay between speech or to ensure that the next speach is queued only after current speach completes.

Parameters

Return value

A Promise that resolves or rejects when the speech is complete.