gpt4 book ai didi

javascript - 如何清除/释放音频接触 html5

转载 作者:行者123 更新时间:2023-11-30 16:40:02 26 4
gpt4 key购买 nike

有没有办法清除/释放/删除 html5 中的音频上下文?

我已经完成了以下教程,但找不到任何内容。

Tutorial

最佳答案

youraudiocontext.close();

够简单吗?

关闭后,可以使用then()方法进行基本重置:

youraudiocontext.close().then(function() {
// set things here //
});

The close() method of the AudioContext Interface closes the audio context, releasing any system audio resources that it uses.

Closed contexts cannot have new nodes created, but can decode audio data, create buffers, etc.

This function does not automatically release all AudioContext-created objects, unless other references have been released as well; however, it will forcibly release any system audio resources that might prevent additional AudioContexts from being created and used, suspend the progression of audio time in the audio context, and stop processing audio data. The returned Promise resolves when all AudioContext-creation-blocking resources have been released. This method throws an INVALID_STATE_ERR exception if called on an OfflineAudioContext.

关于javascript - 如何清除/释放音频接触 html5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32142641/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com