gpt4 book ai didi

javascript - wavesurfer.js destroy() 导致未捕获( promise 中)DOMException : Cannot close a context that is being closed or has already been closed

转载 作者:太空宇宙 更新时间:2023-11-04 15:57:42 29 4
gpt4 key购买 nike

我正在使用wavesurfer在我的网页上显示歌曲波形。我正在使用以下代码 -

function setupSongwaves(songJson) {
var songwaveid = '#song-waveform' + songJson.songid;

var wavesurfer = WaveSurfer.create({
container: songwaveid,
height : 80,
barWidth : 4,
cursorWidth : 2,
waveColor: 'blue',
cursorColor: 'white',
progressColor: 'red'
});

wavesurfer.on('ready', function () {
console.log('ready');
// wavesurfer.play();

setTimeout(function () {
destroyCurrentSongwaves()
},2000);
});

$(document).on("destroy-songwaves", function () {
wavesurfer.destroy();
});

// Hard coding song for now
wavesurfer.load('../assets/song1.mp3');
}

function destroyCurrentSongwaves() {
$.event.trigger({
type: "destroy-songwaves"
});
}

一旦调用wavesurfer.destroy(),我就会在控制台中收到以下错误消息 -

Uncaught (in promise) DOMException: Cannot close a context that is being closed or has already been closed.

一切似乎工作正常,但我每次都会收到此错误,而且我无法找出问题所在。任何帮助将不胜感激!

最佳答案

尝试将Wavesurfer升级到当前最新版本1.3.7,应该可以解决问题。

关于javascript - wavesurfer.js destroy() 导致未捕获( promise 中)DOMException : Cannot close a context that is being closed or has already been closed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42551786/

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