我有一个启动并运行 soundmanager2 的非常简单的示例,它不会在 IOS 中触发:
$(document).ready(function(){
var introSound;
setupSoundManager();
function setupSoundManager(){
soundManager.setup({
// where to find the SWF files, if needed
url: 'swf/',
preferFlash: false,
onready: function() {
// SM2 has loaded, API ready to use e.g., createSound() etc.
createSound();
},
ontimeout: function() {
// Uh-oh. SWF missing, Flash blocked or other issue
console.log('cant setup');
}
});
}
function createSound(){
introSound = soundManager.createSound({
url: 'intro-with-drums.mp3',
// callback for when the sound has loaded
onload: function() {
soundManager._writeDebug(this.id + ' loaded');
enablePlay(this);
}
}).load();
}
function enablePlay(thisSound){
$('#sound').on('click',function(){
introSound.play();
});
}
});
桌面在加载时会经历这个阶段:
sound0: 使用 HTML5 soundmanager2.js:1190 sound0: 加载 (intro-with-drums.mp3) soundmanager2.js:1190 sound0: loadstart soundmanager2.js:1190 sound0: 暂停 sound0: 加载元数据 soundmanager2.js:1190 sound0: 加载数据 soundmanager2。 js:1190 sound0: 可以播放 soundmanager2.js:1190 sound0: onload() soundmanager2.js:1188 sound0 已加载
而iOS只做:
sound0: 使用 HTML5 soundmanager2.js:1190 sound0: 加载 (intro-with-drums.mp3) soundmanager2.js:1190 sound0: loadstart soundmanager2.js:1190 sound0: 暂停
我如何让它在 iOS 上运行?