I'm facing some challenges with muting the audio within my vue app. I have a list of songs that can be played, paused, shuffled, etc., but I can't seem to get the mute function working. Here's what I have in the JavaScript:
mute()
{
if (this.muted) {
return this.volume = this.previousVolume;
}
this.previousVolume = this.volume;
this.volume = 0;
},
And here is the computed method:
muted() {
return this.volume / 100 === 0;
}
I've attempted adding the following:
mutebtn = document.getElementById ("mutebtn")
mutebtn.addEventListener ("click", mute());
In the music player, I have:
<div id="mutebtn">
<i class="icon ion-ios-volume-high" title="Mute" v-if="volume" @click="mute()"></i>
<i class="icon ion-ios-volume-off" title="Unmute" v-if="muted" @click="volume"></i>
</div>
This is my initial attempt at creating a music player, and as someone new to this, I'm getting a bit overwhelmed by the JavaScript aspect. Any assistance would be greatly appreciated!