Set audio source

73 views Asked by At

I have a .wav file in my project and I would like to use it to play on my website. I can't directly use my local .wav's path. Any ideas? I am using Spring mvc 4.0, jetty.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>


<audio id="audio" src="TODO!" autostart="false" ></audio>

<button value="Work work!" onclick="PlaySound()"/>

<script>
    function PlaySound() {
        var sound = document.getElementById("audio");
        sound.play()
    }
</script>
0

There are 0 answers