SoundManager2 WaveFormData和PeakData返回0

时间:2017-01-22 05:04:38

标签: javascript jquery soundmanager2

我试图使用WaveFormData和PeakData设置SoundManager2。 我已根据文档启用了所有内容,但即使正在播放声音,SM对象仍会返回0值。知道为什么吗?

    soundManager.url = 'swf/';
    soundManager.flashVersion = 9;
    soundManager.useHTML5Audio = true;
    soundManager.debugMode = false;
    soundManager.useHighPerformance = true;
    soundManager.useFastPolling = true;
    soundManager.usePeakData = true;
    soundManager.useWaveformData = true;
    soundManager.useEqData = true;

The image is the output of the WaveFormData Property and PeakData Property

知道为什么会这样吗?

2 个答案:

答案 0 :(得分:1)

    soundManager.url = 'swf/';
    soundManager.flashVersion = 9;
    soundManager.useHTML5Audio = true;
    soundManager.debugMode = false;
    soundManager.flash9Options.useWaveformData = true;
    soundManager.flash9Options.useEQData = true;
    soundManager.flash9Options.usePeakData = true;
    soundManager.preferFlash = true;

这就是诀窍:)

答案 1 :(得分:0)

如果您只需要peakData信息,此配置可能会对您有所帮助:

soundManager.flash9Options = {
  usePeakData: true,      // enable left/right channel peak (level) data
  useWaveformData: false, // enable sound spectrum (May set CPUs on fire)
  useEQData: false,       // enable sound EQ (Also CPU-intensive)      
}

然后确保soundmanager使用flash版本9:

soundManager.setup({
  url: '/soundmanager/swf/',
  flashVersion: 9, 
  // useHighPerformance: true,     
  preferFlash: true,      
  debugMode: true,
  onready: function() {},
});

此配置在声音对象

中加载peakData