Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 
avatar of X9DESIGN

X9DESIGN

X9DESIGN has asked 2 questions and find answers to 1 problems.

Stats

61
EtPoint
21
Vote count
2
questions
1
answers

About

Here You have version for multiple instances of audio player.

HTML

<a href="javascript:void(0)" onclick="aud_play_pause(this)">
    <i class="control icon-play"></i>
    <audio class="xnine-player" src="/path/to/file#1.mp3" preload="auto"></audio>
</a>

<a href="javascript:void(0)" onclick="aud_play_pause(this)">
    <i class="control icon-play"></i>
    <audio class="xnine-player" src="/path/to/file#2.mp3" preload="auto"></audio>
</a>

JAVASCRIPT

<script>
    function aud_play_pause(object) {
        var myAudio = object.querySelector(".xnine-player");
        var myIcon = object.querySelector(".control");
        if (myAudio.paused) {
            myIcon.className = "control icon-pause";
            myAudio.play();
        } else {
            myIcon.className = "control icon-play";
            myAudio.pause();
        }
    }
</script>

...