Reputation: 57660
I am using the following code to load sound on iPad Safari.
var EI={sound:{}};
EI.sound.load = function(){
var preferFlash = true;
if (Ext.os.is('iOS') && Ext.browser.is('WebKit'))
preferFlash = false;
// Load sound modules
soundManager.setup({
debugMode: true,
preferFlash: false,
onready: function(){
var s = EI.sound;
s.audio = soundManager.createSound({
id: 'audio',
url: 'sound/sprite.mp3'
});
var opt = s.opt.online, f = opt.start+opt.duration, t=f+1500;
if (s.enabled) s.audio.play({from:opt.start, to:opt.start+opt.duration});
}
});
}
The opt is defined as
EI.sound.opt = {
"msg":{start: 53, duration: 701},
"offline":{start: 1904, duration: 487},
"online":{start: 3548, duration: 2476},
}
And a buttons click
event handler looks like this,
handler: function(btn){
EI.sound.load();
}
The problem is when the button is clicked the sound does not play. I am aware that Mobile Safari has limitation on html5 audio. These are steps that I took to over come it.
But still no sound. I expect to hear sound when I press that button. Its a splash image type button. Its the first button a user must have to press to use the application.
How can I make the audio play successfully?
Here are some resources
Upvotes: 1
Views: 653
Reputation: 167
You are using "EI.sound.load()" while you have to use "EI.sound.play()" or autplay: true in your soundmanager setup.
Upvotes: 0