我想在画布上为音频创建和音频可视化,并决定使用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();
});
})();
答案 0 :(得分:0)
确定已经发现soundobject将useWaveformData设置为false(在控制台中调试后找到它)。
问题可以关闭:)