Skip to content Skip to sidebar Skip to footer

Trying To Play Mp3 Using Vue.js

Goal: Trying to add a background sound to my project with a local file that has a play pause state. Loading an external URL file seems ok and plays/pauses fine, but not local fil

Solution 1:

I simply added the audio src to the audio tag like the below and it worked!

<div class="music-player">
    <audio
      ref="audio"
      src="@/assets/audio/bg-music.ogg"
      preload
      loop
      id="audio"
      muted
    ></audio>
    <div @click="toggleSound()" class="toggle-sound"></div>
  </div>

Post a Comment for "Trying To Play Mp3 Using Vue.js"