SpeechSynthesis: свойство speaking
Базовая Широко поддерживается
Эта функция хорошо отработана и работает на многих устройствах и версиях браузеров. Она доступна в браузерах с сентября 2018 года.
Чтение только свойство speaking интерфейса SpeechSynthesis — это булево значение, которое возвращает true если высказывание в данный момент воспроизводится — даже если SpeechSynthesis находится в состоянии paused.
Значение
Булево значение.
Примеры
const synth = window.speechSynthesis; const utterance1 = new SpeechSynthesisUtterance( "How about we say this now? This is quite a long sentence to say.", ); const utterance2 = new SpeechSynthesisUtterance( "We should say another sentence too, just to be on the safe side.", ); synth.speak(utterance1); synth.speak(utterance2); const amISpeaking = synth.speaking; // will return true if utterance 1 or utterance 2 are currently being spoken
Спецификации
| Спецификация |
|---|
| Web Speech API # dom-speechsynthesis-speaking |
Совместимость браузеров
| Рабочие столы | Мобильные устройства | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari на iOS | Samsung Internet | WebView Android | |
speaking |
33 | 14 | 49 | 21 | 7 | 33 | 62 | Нет | 7 | 3.0 | Нет |
См. также
© 2005–2024 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/speaking