1

<?php
mysqli_select_db($con,'media');
$query = mysqli_query($con,"select * from songs");
while($row = mysqli_fetch_assoc($query))
{
 $url = $row['url'];
 echo"<audio src=\"$url\" controls></audio>";
}
?>

image

Thank you in advance for helping me.

  • https://stackoverflow.com/questions/9437228/html5-check-if-audio-is-playing –  Mar 22 '19 at 00:58
  • Check this solutions : https://stackoverflow.com/questions/43430897/javascript-to-stop-playing-sound-when-another-starts – Shim-Sao Mar 22 '19 at 01:14

1 Answers1

0

I found this solution but the class "play-pause" still on pause how to remove class from all elements except the one of played audio

  document.addEventListener('play', function(e){
        var audios = document.getElementsByTagName('audio');
        for(var i = 0, len = audios.length; i < len;i++){
            if(audios[i] != e.target){
    audios[i].pause();    
            }
        }
    }, true);