element-hq / element-hq/element-web
Support message text-to-speech through `browser.SpeechSynthesis` API
- Dominant language
- TypeScript
- Stars
- 13.5k
- Forks
- 2.8k
- PR merge metrics
- PR metrics pending
Description
### Your use case
#### What would you like to do?
I would like native support for text-to-speech playback of incoming text messages in the Element client.
#### Why would you like to do it?
I am legally blind. Text-to-speech helps me (and other people with print disabilities) keep up with chat.
#### How would you like to achieve it?
Element is a web app, which means it has access to the `[browser.SpeechSynthesis API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis)`. TL;DR the API allows web pages to pass text along to whatever TTS engine is installed on the user's machine, and the OS does the rest.
You can see a working example on Discord. To enable TTS on Discord for all incoming messages, go to the User Menu -> Accessibility.
### Have you considered any alternatives?
Screen readers can theoretically be used to read incoming chat, but practically this is almost impossible. A solution native to the client is best because:
* You don't need to have the chat app open in the foreground and focused
* The chat app can target which content needs to be read - a screenreader is liable to read everything on screen, including mouseover actions and the title bar of the application. Several times.
* TTS integration will, naturally, target incoming messages. A screenreader is likely to read from the top of the screen, or from begining of chat history.
### Additional context
I note that vector-im/element-meta#1626 suggested a specific /tts command for TTS playback of certain messages. While this has its uses (and nuisances), my suggestion is for client-side TTS playback rather than a /tts command.
Contributor guide
Assessment
This issue has not been assessed yet.