Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@capacitor/screen-reader
Advanced tools
The Screen Reader API provides access to TalkBack/VoiceOver/etc. and provides simple text-to-speech capabilities for visual accessibility.
The Screen Reader API provides access to TalkBack/VoiceOver/etc. and provides simple text-to-speech capabilities for visual accessibility.
npm install @capacitor/screen-reader
npx cap sync
import { ScreenReader } from '@capacitor/screen-reader';
ScreenReader.addListener('stateChange', ({ value }) => {
console.log(`Screen reader is now ${value ? 'on' : 'off'}`);
});
const checkScreenReaderEnabled = async () => {
const { value } = await ScreenReader.isEnabled();
console.log('Voice over enabled? ' + value);
};
const sayHello = async () => {
await ScreenReader.speak({ value: 'Hello World!' });
};
isEnabled() => Promise<{ value: boolean; }>
Whether a Screen Reader is currently active.
This method is not supported on web (it is not possible to detect Screen Readers).
Returns: Promise<{ value: boolean; }>
Since: 1.0.0
speak(options: SpeakOptions) => Promise<void>
Text-to-Speech functionality.
This function will only work if a Screen Reader is currently active.
On web, browsers must support the SpeechSynthesis API, or this method will throw an error.
For more text-to-speech capabilities, please see the Capacitor Community Text-to-Speech plugin.
Param | Type |
---|---|
options | SpeakOptions |
Since: 1.0.0
addListener(eventName: 'stateChange', listener: StateChangeListener) => Promise<PluginListenerHandle>
Add a listener for when the screen reader is turned on or off.
This event used to be named 'accessibilityScreenReaderStateChange'
.
This method is not supported on web (it is not possible to detect Screen Readers).
Param | Type |
---|---|
eventName | 'stateChange' |
listener | StateChangeListener |
Returns: Promise<PluginListenerHandle>
Since: 1.0.0
removeAllListeners() => Promise<void>
Remove all the listeners that are attached to this plugin.
Since: 1.0.0
Prop | Type | Description | Since |
---|---|---|---|
value | string | The text to speak. | 1.0.0 |
language | string | The language to speak the text in, as its ISO 639-1 Code (e.g.: "en"). This option is only supported on Android. | 1.0.0 |
Prop | Type |
---|---|
remove | () => Promise<void> |
Prop | Type | Description | Since |
---|---|---|---|
value | boolean | Whether a Screen Reader is currently active. | 1.0.0 |
(state: ScreenReaderState): void
FAQs
The Screen Reader API provides access to TalkBack/VoiceOver/etc. and provides simple text-to-speech capabilities for visual accessibility.
The npm package @capacitor/screen-reader receives a total of 6,422 weekly downloads. As such, @capacitor/screen-reader popularity was classified as popular.
We found that @capacitor/screen-reader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.