[Vuejs]-Why is audio tag not working after refresh page

0👍

I am not really sure whats causing this exactly but there is another way you can play your audio …this will trigger the audio load() :

new Vue({
  el: "#app",
  mounted: function() {
    this.$nextTick(() => {
      this.$refs.audio.load()
    })
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
  <div>
    <audio ref="audio" autoplay loop>
         <source src="https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg"
                 type="audio/ogg"
         > 
    </audio>
  </div>
</div>

Leave a comment