add mute/unmute with the volume icon (#355)
This commit is contained in:
committed by
Feross Aboukhadijeh
parent
ae73ae29c4
commit
457aca25ee
@@ -321,7 +321,7 @@ function renderPlayerControls (state) {
|
||||
elements.push(hx`
|
||||
<div.volume
|
||||
onwheel=${handleVolumeWheel}>
|
||||
<i.icon.volume-icon>
|
||||
<i.icon.volume-icon onmousedown=${handleVolumeMute}>
|
||||
${volumeIcon}
|
||||
</i>
|
||||
<input.volume-slider
|
||||
@@ -358,6 +358,15 @@ function renderPlayerControls (state) {
|
||||
dispatch('changeVolume', (-e.deltaY | e.deltaX) / 500)
|
||||
}
|
||||
|
||||
// Handles volume muting and Unmuting
|
||||
function handleVolumeMute (e) {
|
||||
if (state.playing.volume === 0.0) {
|
||||
dispatch('setVolume', 1.0)
|
||||
} else {
|
||||
dispatch('setVolume', 0.0)
|
||||
}
|
||||
}
|
||||
|
||||
// Handles volume slider scrub
|
||||
function handleVolumeScrub (e) {
|
||||
switch (e.type) {
|
||||
|
||||
Reference in New Issue
Block a user