我有一个存储为变量的 AudioBuffer,我想让它由一个音频元素播放。这是我当前无法运行的代码:
const blob = new Blob(audioBuffer.getChannelData(1), { type: "audio/wav" });
const url = window.URL.createObjectURL(blob);
audioElement.src = url;
当我尝试播放 audioElement 时,出现以下错误:
Uncaught (in promise) DOMException: 该元素没有支持的来源。
有没有人对如何解决这个问题有任何想法?提前致谢!