大网数据广告活动
Web 标准与前端开发

suspend

· 52CE 我爱测

The **`suspend()`** method of the OfflineAudioContext interface schedules a suspension of the time progression in the audio context at the specified time and returns a promise. This is generally useful at the time of manipulating the audio graph synchronously on OfflineAudioConte

Web Audio API

The suspend() method of the OfflineAudioContext interface schedules a suspension of the time progression in the audio context at the specified time and returns a promise. This is generally useful at the time of manipulating the audio graph synchronously on OfflineAudioContext.

Note that the maximum precision of suspension is the size of the render quantum and the specified suspension time will be rounded down to the nearest render quantum boundary. For this reason, it is not allowed to schedule multiple suspends at the same quantized frame. Also scheduling should be done while the context is not running to ensure the precise suspension.

语法

OfflineAudioContext.suspend(suspendTime).then(function() { ... });

参数

  • 暂停时间
    • : A double 指定暂停的时间。

返回值

A Promise resolving to void.

异常

发生任何异常,promise 就会拒绝。

  • InvalidStateError DOMException
    • : 如果帧数出现下列情况,则抛出该异常:
      • 一个负值
      • 小于或等于当前时间
      • 大于或等于渲染的总渲染时间
      • is scheduled by another suspend for the same time

Specifications

Browser compatibility

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。