Soundmanager2加载但不播放

时间:2012-12-21 20:17:23

标签: playback soundmanager2

设置 在我的网站上安装了Soundmanager2。将自动生成MP3链接。

问题 使用360-ui,我看到声音加载,因为它播放动画,就像在这个演示的左上角(http://www.schillmania.com/projects/soundmanager2/demo/360-player/),但它没有不玩,秒计数器也不动。

我如何加载球员

<link rel="stylesheet" type="text/css" href="/css/360player.css" />
<link rel="stylesheet" type="text/css" href="/css/flashblock.css" />
<!-- special IE-only canvas fix -->
<!--[if IE]><script type="text/javascript" src="/js/excanvas.compiled.js"></script><![endif]-->

<!-- Apache-licensed animation library -->
<script type="text/javascript" src="/js/berniecode-animator.js"></script>
<script type="text/javascript" src="/js/soundmanager2.js"></script>
<script type="text/javascript" src="/js/360player.js"></script>

<script type="text/javascript">
soundManager.setup({
  // path to directory containing SM2 SWF
  url: '/swf/',  debugMode: true 
});
</script>

调试代码

-- SoundManager 2: HTML5 support tests (/^(probably|maybe)$/i): mp3: true (preferring flash), mp4: true (preferring flash), ogg: true, wav: true -- soundmanager2.js:1155
-- SoundManager 2 V2.97a.20121104 (AS3/Flash 9) + HTML5 audio, high performance mode, normal polling, wmode: transparent, flashBlock mode -- soundmanager2.js:1155
soundManager::createMovie(): Trying to load /swf/soundmanager2_flash9_debug.swf soundmanager2.js:1155
soundManager::initMovie(): Waiting for ExternalInterface call from Flash... soundmanager2.js:1157
soundManager::externalInterfaceOK() (~2 ms) soundmanager2.js:1157
soundManager::init() soundmanager2.js:1157
soundManager: Attempting JS to Flash call... soundmanager2.js:1157
(Flash): SM2 SWF V2.97a.20121104 (AS3/Flash 9) soundmanager2.js:1157
Flash security sandbox type: remote soundmanager2.js:1157
(Flash): JS to/from Flash OK soundmanager2.js:1157
(Flash): Enabling polling, 10 ms interval soundmanager2.js:1157
-- SoundManager 2 loaded (OK) -- soundmanager2.js:1155
soundManager: Firing 1 onready() item soundmanager2.js:1157
threeSixtyPlayer.init() soundmanager2.js:1157
threeSixtyPlayer.init(): Found 5 relevant items. soundmanager2.js:1157
handleClick() soundmanager2.js:1157
soundManager.createSound(): ui360Sound0 (http://clients.activemd.net/external/x.mp3) soundmanager2.js:1155
SMSound() merged options: {
 id: ui360Sound0, 
 url: http://clients.activemd.net/external/x.mp3, 
 onplay: { pl.removeClass(this._360data.oUIBox,this._360data.className); t... }, 
 onstop: { pl.removeClass(this._360data.oUIBox,this._360data.className); t... }, 
 onpause: { pl.removeClass(this._360data.oUIBox,this._360data.className); t... }, 
 onresume: { pl.removeClass(this._360data.oUIBox,this._360data.className); t... }, 
 onfinish: { var nextLink; pl.removeClass(this._360data.oUIBox,this._360data... }, 
 onbufferchange: { if (this.isBuffering) { pl.addClass(this._360data.oUIBox,pl.css... }, 
 whileloading: { if (this.paused) { self.updatePlaying.apply(this); } }... }, 
 whileplaying: { self.updatePlaying.apply(this); this._360data.fps++; }... }, 
 useWaveformData: 0, 
 useEQData: 0, 
 usePeakData: 0, 
 autoLoad: false, 
 autoPlay: false, 
 loops: 1, 
 multiShot: true, 
 multiShotEvents: false, 
 pan: 0, 
 stream: true, 
 usePolicyFile: false, 
 volume: 100, 
 isMovieStar: false, 
 bufferTime: 3
} soundmanager2.js:1157
(Flash): SoundManager2_SMSound_AS3: Got duration: 0, autoPlay: false soundmanager2.js:1157
SMSound.play(): Attempting to load "ui360Sound0" soundmanager2.js:1155
SMSound.load(): http://clients.activemd.net/external/x.mp3 soundmanager2.js:1155
SMSound.play(): "ui360Sound0" is starting to play soundmanager2.js:1157
fanOut: ui360Sound0: http://clients.activemd.net/external/x.mp3 soundmanager2.js:1157
SMSound._onbufferchange(): 1 soundmanager2.js:1157
(Flash): start (ui360Sound0): 0 soundmanager2.js:1157
SMSound._onbufferchange(): 0 soundmanager2.js:1157
SMSound._onload(): "ui360Sound0" loaded.

THE WEIRDNESS 这些链接可在我的Chrome开发者视图中点击,MP3可在单独的浏览器窗口中打开并正常播放(默认情况下,点击Chrome中的MP3链接)

一个可能的理论 声音正在加载,但不会被告知“好吧,继续玩自己”。

另一种可能的理论 jQuery以某种方式搞砸了它。

请帮我确定我的声音加载但不播放的原因。

感谢。 瑞克

1 个答案:

答案 0 :(得分:1)

我在自动播放方面遇到了类似的问题。它在Safari中运行良好,但Chrome和FireFox,IE只是追踪它们正在播放,没有任何事情发生。我最终放入一个setTimeout来调用soundManager.play(id),但我不喜欢我必须这样做。

我注意到其他开发者使用click()事件来触发歌曲。我不知道是否通过点击事件路由它的次要延迟是它需要播放与否,但我尝试将超时设置为200和500+毫秒似乎是票。我还想过,当自动播放失败时,缓冲事件或加载事件可能会触发播放。在soundManager.createSound(e)之后立即调用soundManager.play(id)在我的结尾完全没有任何意义。

我添加了一个onbufferchange事件并检查了playState。如果它不玩,我告诉它玩。这摆脱了对setTimeout的需求。