I\'m working on a website that has a chat for a client, however, we\'re experiencing problems with audio in iPad (iOS 5).
The target is in fact the iPad with support
The Apple iPad does not allow playing sounds without a user click previously initiating it.
Solution: Add a play/pause button.
App.toggle_audio = function(elem) {
var icon = elem.find("i");
var playing = _.include(icon.attr('class').split(" "), "icon-pause")
if (playing) {
elem.html(" " + App.translate_play_audio);
App.play_audio_toggle = false;
} else {
App.audio_file.load();
elem.html(" " + App.translate_pause_audio);
App.play_audio_toggle = true;
}
}
Once the user clicked the button once the Audio is loaded. You can then play it via Javascript.
if (App.play_audio_toggle) {
App.audio_file.play();
}