I've seen this: How to play sound when the current time equals to specific time But i can't use the object in the html in my situation. I just have the path of my music in a service.
And I don't know why but I can't set my music at a current time when I have to continu.
audioObj = new Audio()
play(music: Music): void {
this.audioObj.src = this.baseUrl + music.fileUrl
this.audioObj.load()
}
And this is in my constructor :
this.audioObj.addEventListener('loadedmetadata', (audio:any) => {
this.audioObj.currentTime = 50 // just for my test
this.audioObj.play() // but my music start over at 0
})
Thank you so much if you have the solution :)