SpeechSynthesis: resume() 方法

Baseline 已廣泛支援

此功能已成熟,並可在多種裝置和瀏覽器版本上使用。自 2018 年 9 月以來,它已在各種瀏覽器中推出。

resume() 方法是 SpeechSynthesis 介面的一部分,它將 SpeechSynthesis 物件置於非暫停狀態:如果它已被暫停,則恢復朗讀。

語法

js
resume()

引數

無。

返回值

無(undefined)。

示例

js
let synth = window.speechSynthesis;

let utterance1 = new SpeechSynthesisUtterance(
  "How about we say this now? This is quite a long sentence to say.",
);
let utterance2 = new SpeechSynthesisUtterance(
  "We should say another sentence too, just to be on the safe side.",
);

synth.speak(utterance1);
synth.speak(utterance2);

synth.pause(); // pauses utterances being spoken
synth.resume(); // resumes speaking

規範

規範
Web Speech API
# dom-speechsynthesis-resume

瀏覽器相容性

另見