I'm currently developing a Vue 3 audio player integration with the Napster API.
Project specifics
The player features a progress bar where I utilize the trackProgress
computed property for real-time progress updates:
<div class="progress-bar">
<span :style="{ width: trackProgress + '%' }"></span>
</div>
The challenge
I have encountered an issue where the style is not properly applied to the span element within the progress-bar
.
What am I overlooking?
UPDATE
Although using setInterval
in the created hook functions, I seek an alternative method. Any suggestions?
this.player.addEventListener("loadedmetadata", () => {
setInterval(() => {
this.trackProgress =
(this.player.currentTime / this.player.duration) * 100;
}, 100);
});