我想为画布上的音频创建音频可视化并决定使用 SoundManager2。问题是应该返回波形数据的函数会抛出空数组。知道该怎么做吗?(我听到声音播放,所以它加载正确:))
<script>
(function() {
soundManager.url = 'swf/';
soundManager.flashVersion = 9;
soundManager.onready(function() {
var i = 0;
var song = soundManager.createSound({
id: 'song',
url: 'https://www.mash-up.pl/sites/default/files/mp3/HF028A.mp3'
});
console.log(soundManager.features.waveformData); // true
function draw() {
// emit waveform data every once in a while as to not break console
if (!(i % 200)) {
// wth these are empty
console.log(song.waveformData.left);
console.log(song.waveformData.right);
}
i++;
window.webkitRequestAnimationFrame(draw);
}
draw();
song.play();
});
})();