为什么Soundmanager 2不会在firefox(23)中触发onload事件?

时间:2013-08-15 10:12:05

标签: javascript soundmanager2

我正在使用Soundmanager 2来播放mp3音频流。不知何故,onload事件不会在Firefox中触发。在Safari和Chrom,它运作良好。 当我将自动播放设置为true时,即使在firefox中也会播放流,它只是onload事件巫婆无法正常工作。

soundManager.setup({
    url: '/static/soundmanager2/swf',
    flashVersion: 9,
    preferFlash: false,
    useHTML5Audio: true,
    onready: function() {
        var options = {
        id: 'channel-'+num,
        url: chan.url,
        stream: true,
        onload: function() { alert("loaded"); },
        volume: 50,
        autoPlay:true
        };
        this.SM = soundManager.createSound(options)
    }
});

1 个答案:

答案 0 :(得分:3)

事实证明,文档存在问题。从选项中删除onload并使用sound.load方法。

将您的代码更改为:

var sound = soundManager.createSound(options);
sound.load( { 
  onload: function() { 
    alert('works'); 
  } 
});
this.SM = sound;
相关问题