P
P
Pavel Kityan2014-07-08 21:11:08
JavaScript
Pavel Kityan, 2014-07-08 21:11:08

HTML5 Audio: why can't playing two files one after the other work on some platforms?

Comrades. I read diagonally about various problems with simultaneous audio playback on mobile platforms, about some delays on iOS. But here's the thing - I don't understand.
Code snippet:

var player1 = $('<audio preload="auto"  src="file1.mp3" type="audio/mp3" />').appendTo(myDiv);
var player2 = $('<audio preload="auto"  src="file2.mp3" type="audio/mp3" />').appendTo(myDiv); 
var btnPlay = $('<div />').appendTo(myDiv).on('click', play1); 

function play1(){
               player1[0].addEventListener("ended", play2);
               player1[0].play();
}

 function play2(){
               player1[0].removeEventListener("ended", play2);
               player2[0].play();
}

On the desktop (Win7 and Firefox, for example), everything is in a bundle. On iOS7 (iPad) and Android of some kind - the second file is not played. Although the handler starts on the event.
I tried on Andorid to call simultaneously playing the second file along with the first one in play1() and then it also played in play2(), but this obviously does not suit me.
Access to HTML and its resources is done over the network, to the http server.
Mobile platforms don't preload audio files? Or what?
What the hell, tell me please! And then we run into the option - to do gluing files, but this is such a crap. We have file #1 and a hundred files #2. Glue? Well Yoshkin cat ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2014-07-08
@bookworm

www.ibm.com/developerworks/en/library/wa-ioshtml5/...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question