Reputation: 221
I post here because I use the HTML5 audio tag to develop open source software to help people with disabilities.
I realize that apple locks the reading of the audio file without user interaction ( AudioVideo Conceptual Using HTML5 Audio Video Device SpecificConsiderations ). However, this make non-functional my application on Ipad, Iphone in all browser (I tried google chrome and safari).
Despite much research, I have not found any solution (browser for this feature, configuration could be done on the device, via a trick simulated click, ...), which give the application unusable.
If someone has an idea how to "get around" this limitation, I would appreciate it.
ps: I understand that this is not the default behavior, but I have access to test equipment to develop the application, which can allow me to make configuration disability could not do.
ps bis: the application works perfectly on computer and firefox for android.
Code:
function makeAttente() {
"use strict";
var i, o, taille;
taille = audios.length;
for (i = 0; i < taille; i++) {
o = audios[i];
if(i<taille-1){
(function(arg1) {
o.addEventListener('ended', function() {
playSound(arg1+1);
}, false);
})(i);
document.getElementById("audio").innerHTML += "<br/> mot numero " + i + " d'une durée de " + o.duration + " secondes est écouté pour la fin pour le mot " + (i+1);
}
else{
if(! o.loadeddata ){
o.addEventListener('loadeddata',playSound(0), false);
}
else{
playsound(0);
}
document.getElementById("audio").innerHTML += "<br/> mot numero " + i + " est écouté pour la fin de chargement pour le mot " + (i+1);
}
}
}
function playSound(nbSon) {
"use strict";
var a, d;
if(nbSon === 0 ||audios[(nbSon-1)].played.length === 1){
a = audios[nbSon];
d = new Date();
document.getElementById("audio").innerHTML += "<br/> audio" + nbSon + " d'une durée de " + a.duration + " lancé avec le son " + a.currentSrc + " au temps >>> " +d.getMinutes() + ":"+d.getSeconds() + ":" + d.getMilliseconds();
a.volume = 1;
a.click();
a.play();
}
};
the Internet address of the page concerned (French project for now): http://ci.worldheberg.com/fr-appli-test.html
edit : the global variable audios contain all the audios dom element and you can show a little debugger in the audio's div
Upvotes: 1
Views: 480
Reputation: 1429
Because this is an Apple limitation, your app will most likely get blocked when trying to submit to the App Store even if you find a way around the policies.
That said, I would recommend you setup your app with a "start" button of some sort that is displayed when an iOS device is found. The button could be the size of the screen so if anything is touched, your audio can begin playing.
Hope this helps!
Upvotes: 1