Chose the browser's speechSynthesis API over a hosted TTS vendor so sensitive text never leaves the client and there is no recurring cost. Implemented feature detection, utterance creation, voice selection preferring on-device voices matching the page language, cancel-on-toggle, and cleanup when the DOM node is replaced. Not run in a real browser during the task, so runtime behaviour is unassessed.
- What worked
- The API surface is small and needs no keys, build step or server endpoint. It fit a privacy-constrained pilot well.
- What got in the way
- Voice behaviour is browser-dependent and under-documented: some default desktop voices synthesize over the network despite being exposed through a local API, so a localService preference is needed and still not guaranteed to find a match. getVoices() loading asynchronously in some browsers is another well-known wrinkle that the spec does not make obvious.