Reader Documentation

About Reader

Allows for easy integration of text to speech capabilities with minimal JavaScript. The Reader class has integrated easy to use highlighting and voice altering abilities.

table of contents

Test Console



Detailed Documentation

read

.read( );
Description: reads the selected element with pre-set element and settings. .

readOnFinish

.readOnFinish( HTMLElement element );
Description: Reads the input element after the previous elements have finished reading..

cancel

.cancel( );
Description: Cancels all reading events and resets highlighting element. Triggers onend event. See setOnEnd()..

pause

.pause( );
Description: Pauses all reading actions. Triggers onpause event. See setOnPause( func )..

resume

.resume( );
Description: Resumes speech actions. Fires onresume event. see setOnResume(func)..

setElement

.setElement( );
Alters: element default: null
Description: Sets the reader to read the input element.

setHightlight

.setHightlight( string color );
Alters: highlightColor default:
Description: Sets the color of the readers highlighting feature. Pass it "none" to remove highlighting. Highlights will be affected by stylings on 'c' type elements..

setVoice

.setVoice( number or SpeechSyntheticVoice voice );
Alters: voice default: voices[0]
Description: Set the read back voice either by entering a number to indicate the index of the voice in the voices array (see getVoices()) or by passing it a <a href="https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice" target="_blank"> SpeechSyntheticVoice</a> object..

setOnBoundary

.setOnBoundary( function func() );
Alters: onboundary default: null
Description: Used to set an external boundary event which will fire once a boundary event is reached. Fired right before the highlighting function. .for more information visit this link

setSpeed

.setSpeed( number speed );
Alters: speed default: 1
Description: Sets the readers speed from a scale of 0.1 (slowest) to 10 (fastest)..for more information visit this link

setPitch

.setPitch( number pitch );
Alters: pitch default: 1
Description: Sets the pitch of the voice from a scale of .1 to 2 (.1 being lower pitched)..for more information visit this link

setOnMark

.setOnMark( function func() );
Alters: onmark default: null
Description: Sets the onmark event function that is fired when the reader hits a SSML mark tag..for more information visit this link

setOnStart

.setOnStart( function func() );
Alters: onstart default: null
Description: Sets the readers onstart event that is fired when the utterance starts..for more information visit this link

setOnPause

.setOnPause( function func() );
Alters: onpause default: null
Description: Sets the onpause event function. Called whenever the speech is paused on the readers set element..for more information visit this link

setOnResume

.setOnResume( function func() );
Alters: onresume default:
Description: Sets the function that will be triggered when a the reader is resumed..for more information visit this link

setOnError

.setOnError( function func() );
Alters: onerror default: null
Description: Sets the function that is to be fired when an error occurs with the reader while reading..for more information visit this link

readWhen

.readWhen( string html_eventHTMLElement element );
Description: Sets up an event listener to call to read the element when the event is fired. Allows for a single line script to read an element when event is called..

docs

.docs( );
Description: Sends the caller to this page for documentation..

report

.report( );
Description: Sends the calling window to a bug/suggestion report page..

setOnEnd

.setOnEnd( func callback );
Description: Sets a function to be called when the reader is done reading a given set of words..

setLanguage

.setLanguage( String language );
Alters: lang default: en-US
Description: Used to change the language of the reader. For information on the available languages visit <a href="https://appmakers.dev/bcp-47-language-codes-list/">https://appmakers.dev/bcp-47-language-codes-list/ </a>.

setUseDefaultButton

.setUseDefaultButton( Boolean useDefault );
Alters: useDefaultButton default: False
Description: Used to tell the reader to generate a pause play button when initiated. Design can be modified in Reader.css and by using the <a href="#setPlayIcon">setPlayIcon Method</a> and <a href="#setPauseIcon">setPauseIcon Method</a>..

setPauseIcon

.setPauseIcon( String Icon );
Alters: pauseIcon default: pause_circle
Description: Sets the icon for the default play/pause button..for more information visit this link

setPlayIcon

.setPlayIcon( String Icon );
Alters: playIcon default: play_circle
Description: Sets the play icon for the play/pause button..for more information visit this link