为什么Soundmanager 2不会在firefox(23)中触发onload事件? [英] Why does Soundmanager 2 not fire onload event in firefox (23)?

查看:326
本文介绍了为什么Soundmanager 2不会在firefox(23)中触发onload事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using Soundmanager 2 to play an mp3 audio stream. Somehow the onload event will not be fired in Firefox. In Safari and Chrom it worked well. When i set autoplay to true the stream will be played even in firefox, its just the onload events witch is not working.

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)
    }
});


推荐答案

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

It's a problem with the documentation as it turns out. Remove the onload from the options and use the sound.load method.

将代码更改为:

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

这篇关于为什么Soundmanager 2不会在firefox(23)中触发onload事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆