I have set up a Vue-audio player in my Vue.js application using the AudioPlayer component. This is my code:
<template>
<vue-audio id = "myAudio" :file= "file1"/>
</template>
<script>
import VueAudio from 'vue-audio';
export default {
props: {
file1: String,
},
components: {
'vue-audio': VueAudio,
},
mounted (){
setTimeout(function() {
document.getElementById('myAudio').play()
}, 3000);
},
name: 'AudioPlayer',
};
</script>
However, I am running into an issue that generates the following error message:
Uncaught TypeError: document.getElementById(...).play is not a function