SpeechSynthesis.paused

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2018.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

SpeechSynthesis 接口的只读属性 paused 是一个 Boolean 值,当SpeechSynthesis对象处于暂停状态时,返回true ,否则返回 false

它能被设置为 暂停状态 即使当前并没有语音在播放队列中。如果utterances 被添加到语音播放队列,队列中的语音并不会播放直到使用 SpeechSynthesis.resume()使SpeechSynthesis对象处于非暂停状态。

语法

var amIPaused = speechSynthesisInstance.paused;

Value

一个Boolean

示例

js
var synth = window.speechSynthesis;

synth.pause();

var amIPaused = synth.paused; // 将返回 true

规范

Specification
Web Speech API
# dom-speechsynthesis-paused

浏览器兼容性

请参阅