OfflineAudioContext.suspend
的浏览器兼容性表中有一个针对Firefox的空单元格,这非常令人困惑。
它在 Chrome 中运行良好。我仍然认为
OfflineAudioContext.suspend
目前已在 Firefox (v51.0.1) 中实现,因为我可以调用该方法。我的问题是,每当我调用这个方法时,我都会得到:
DOMException [NotSupportedError: "Operation is not supported"
code: 9
nsresult: 0x80530009
location: http://localhost:4200/main.bundle.js:13603]
这是两个主要调用的顺序
offlineContext.suspend(0).then(() => ..., e => console.log(e))
offlineContext.startRendering()
console.log(e)
打印上面的错误消息,因此不会进入then
的成功回调。
我尝试修改
suspend
方法的“suspendTime”参数,将调用放在 startRendering
方法之后,但没有成功。
它真的应该在 Firefox 中工作吗?我认为他们允许我们调用该方法,但却让它一直失败,这很奇怪。
很可能 Firefox 还没有在离线环境中实现此功能。 (不过,我认为在线音频上下文支持暂停)。
不幸的是,Firefox 115.14.0esr (
OfflineAudioContext.suspend is not a function
) 不支持 OfflineAudioContext.suspend。