最佳答案
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/