Search code examples
jqueryaudiosafarimobile-safarihtml5-audio

Html 5 Audio is not working in iphone safari browser


I'm developing web application that contain audio player functionality.

I'm using html-5 audio tag and its working fine in chrome... but not working in iPhone safari browser.

I'm using color-box jQuery lib for popup slider dialog and in popup I'm playing audio files one by one.( my process is kind of auto play and i'm doing manually) playing first audio then second audio..in one slide want to play 2 audio files.

In popup init function i wrote below code

audio1.play();
audio1.on('ended' function(){
audio2.play();
});

In iphone safari its not working.(But working in windows and android) ※From second slide its working like pc mode..

Its working fine in PC, but not working in iPhone safari.

Can anyone help me solve this?

Thanks in advance


Solution

  • Did like below code and solved problem

    Added two lines before play

    audio1.load();
    audio2.load();
    

    audio1.play();
    audio1.on('ended' function(){
    audio2.play();
    });