Googlebot
Googlebot

Reputation: 15683

How to play all audios in the same html5 page?

I have several html5 audio players in an html table as

<tr>
    <td>
        <audio controls><source src="file1.flac" type="audio/flac"></audio>
    </td>
</tr>
<tr>
    <td>
        <audio controls><source src="file2.flac" type="audio/flac"></audio>
    </td>
</tr>

How can I continue playing file2 when file1 finishes? Or how can I tell html5 to play only one file on the whole page (if playing a file the one which is playing should be stopped)?

It is like having a list of audios, but I cannot place all files together in a list, as they should be distributed in the table rows.

Upvotes: 0

Views: 30

Answers (1)

Diego Avila
Diego Avila

Reputation: 738

you can use javascript: in this case detect is playing:

    function isPlaying(myAudio1) {
     //do something 

   }else{
    //play Audio2
    var x = document.getElementById("myAudio2"); 
    x.play(); 
  }

for more details check this i suggest use:

 window.onload = isPlaying;//run function on load page

Upvotes: 1

Related Questions