Answer the question
In order to leave comments, you need to log in
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();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question