A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ja/docs/Web/API/SpeechSynthesisErrorEvent below:

SpeechSynthesisErrorEvent - Web API | MDN

SpeechSynthesisErrorEvent

Baseline Widely available

SpeechSynthesisErrorEvent はウェブ音声 API のインターフェイスで、発話サービスの SpeechSynthesisUtterance オブジェクトの処理中に発生したエラーに関する情報を保持します。

Event SpeechSynthesisEvent SpeechSynthesisErrorEvent コンストラクター
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