SpeechSynthesis: resume() メソッド
Baseline
広く利用可能
この機能は広く実装されており、多くのバージョンの端末やブラウザーで動作します。2018年9月以降、すべてのブラウザーで利用可能です。
resume() は SpeechSynthesis インターフェイスのメソッドで、SpeechSynthesis オブジェクトを一時停止していない状態に戻します。つまり、すでに一時停止している場合は、発話を再開します。
構文
js
resume()
引数
なし。
返値
なし (undefined)。
例
js
let synth = window.speechSynthesis;
const utterance1 = new SpeechSynthesisUtterance(
"こう言ってみてはどうでしょうか?これを言うと、かなり長い文章になります。",
);
const utterance2 = new SpeechSynthesisUtterance("念のため、もう一言言います。");
synth.speak(utterance1);
synth.speak(utterance2);
synth.pause(); // 発話を一時停止
synth.resume(); // 発話を再開
仕様書
| 仕様書 |
|---|
| Web Speech API> # dom-speechsynthesis-resume> |