Baseline Widely available
SpeechSynthesisErrorEvent
ã¯ã¦ã§ãé³å£° API ã®ã¤ã³ã¿ã¼ãã§ã¤ã¹ã§ãçºè©±ãµã¼ãã¹ã® SpeechSynthesisUtterance
ãªãã¸ã§ã¯ãã®å¦çä¸ã«çºçããã¨ã©ã¼ã«é¢ããæ
å ±ãä¿æãã¾ãã
SpeechSynthesisErrorEvent()
æ°ãã SpeechSynthesisErrorEvent
ã¤ãã³ããçæãã¾ãã
SpeechSynthesisErrorEvent
㯠SpeechSynthesisEvent
ã¤ã³ã¿ã¼ãã§ã¤ã¹ããæ´¾çãã¦ããã親ã¤ã³ã¿ã¼ãã§ã¤ã¹ã§ãã Event
ããããããã£ãç¶æ¿ãã¦ãã¾ãã
SpeechSynthesisErrorEvent.error
èªåå°ç¨
é³å£°åæã«å¤±æãããã¨ã示ãã¨ã©ã¼ã³ã¼ããè¿ãã¾ãã
SpeechSynthesisErrorEvent
㯠SpeechSynthesisEvent
ã¤ã³ã¿ã¼ãã§ã¤ã¹ããæ´¾çãã¦ããã親ã¤ã³ã¿ã¼ãã§ã¤ã¹ã§ãã Event
ããã¡ã½ãããç¶æ¿ãã¦ãã¾ãã
const synth = window.speechSynthesis;
const inputForm = document.querySelector("form");
const inputTxt = document.querySelector("input");
const voiceSelect = document.querySelector("select");
const voices = synth.getVoices();
// ...
inputForm.onsubmit = (event) => {
event.preventDefault();
const utterThis = new SpeechSynthesisUtterance(inputTxt.value);
const selectedOption =
voiceSelect.selectedOptions[0].getAttribute("data-name");
for (let i = 0; i < voices.length; i++) {
if (voices[i].name === selectedOption) {
utterThis.voice = voices[i];
}
}
synth.speak(utterThis);
utterThis.onerror = (event) => {
console.log(
`An error has occurred with the speech synthesis: ${event.error}`,
);
};
inputTxt.blur();
};
仿§æ¸ ãã©ã¦ã¶ã¼ã®äºææ§ é¢é£æ
å ±
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4