2023-08-27 22:20:34 +02:00
|
|
|
<template>
|
2024-09-03 16:12:11 +02:00
|
|
|
<div>
|
2024-05-06 12:47:47 +00:00
|
|
|
<VolumeHighIcon
|
2024-08-09 09:38:00 +00:00
|
|
|
v-if="volume > 0.7"
|
2024-05-06 12:47:47 +00:00
|
|
|
class="pointer"
|
|
|
|
:size="30"
|
|
|
|
@click="mute" />
|
2024-04-30 00:48:47 +02:00
|
|
|
<VolumeLowIcon
|
2024-08-09 09:38:00 +00:00
|
|
|
v-if="volume > 0 && volume <= 0.3"
|
2023-08-27 22:20:34 +02:00
|
|
|
class="pointer"
|
|
|
|
:size="30"
|
|
|
|
@click="mute" />
|
2024-04-30 00:48:47 +02:00
|
|
|
<VolumeMediumIcon
|
2024-08-09 09:38:00 +00:00
|
|
|
v-if="volume > 0.3 && volume <= 0.7"
|
2023-08-27 22:20:34 +02:00
|
|
|
class="pointer"
|
|
|
|
:size="30"
|
|
|
|
@click="mute" />
|
2024-04-30 00:48:47 +02:00
|
|
|
<VolumeMuteIcon
|
2024-08-09 09:38:00 +00:00
|
|
|
v-if="volume === 0"
|
2023-08-27 22:20:34 +02:00
|
|
|
class="pointer"
|
|
|
|
:size="30"
|
2024-08-09 09:38:00 +00:00
|
|
|
@click="setVolume(volumeMuted)" />
|
2024-04-30 00:48:47 +02:00
|
|
|
<input
|
|
|
|
max="1"
|
2023-08-28 00:02:07 +02:00
|
|
|
min="0"
|
|
|
|
step="0.1"
|
|
|
|
type="range"
|
2024-08-09 09:38:00 +00:00
|
|
|
:value="volume"
|
|
|
|
@change="(event) => setVolume(event.target.value)" />
|
2023-08-27 22:20:34 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-08-09 09:38:00 +00:00
|
|
|
import { mapActions, mapState } from 'pinia'
|
2024-03-16 18:35:31 +01:00
|
|
|
import VolumeHighIcon from 'vue-material-design-icons/VolumeHigh.vue'
|
|
|
|
import VolumeLowIcon from 'vue-material-design-icons/VolumeLow.vue'
|
|
|
|
import VolumeMediumIcon from 'vue-material-design-icons/VolumeMedium.vue'
|
|
|
|
import VolumeMuteIcon from 'vue-material-design-icons/VolumeMute.vue'
|
2024-08-09 09:38:00 +00:00
|
|
|
import { usePlayer } from '../../store/player.js'
|
2023-08-27 22:20:34 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Volume',
|
|
|
|
components: {
|
2024-03-16 18:35:31 +01:00
|
|
|
VolumeHighIcon,
|
|
|
|
VolumeLowIcon,
|
|
|
|
VolumeMediumIcon,
|
|
|
|
VolumeMuteIcon,
|
2023-08-27 22:20:34 +02:00
|
|
|
},
|
2024-08-22 13:30:52 +02:00
|
|
|
data: () => ({
|
|
|
|
volumeMuted: 0,
|
|
|
|
}),
|
2023-08-27 22:20:34 +02:00
|
|
|
computed: {
|
2024-08-09 09:38:00 +00:00
|
|
|
...mapState(usePlayer, ['volume']),
|
2023-08-27 22:20:34 +02:00
|
|
|
},
|
|
|
|
methods: {
|
2024-08-09 09:38:00 +00:00
|
|
|
...mapActions(usePlayer, ['setVolume']),
|
2023-08-27 22:20:34 +02:00
|
|
|
mute() {
|
2024-08-09 09:38:00 +00:00
|
|
|
this.volumeMuted = this.volume
|
|
|
|
this.setVolume(0)
|
2023-08-27 22:20:34 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2024-09-03 16:12:11 +02:00
|
|
|
div {
|
2024-04-30 00:48:47 +02:00
|
|
|
align-items: center;
|
|
|
|
display: flex;
|
|
|
|
gap: 5px;
|
|
|
|
justify-content: flex-end;
|
|
|
|
}
|
2023-08-27 22:20:34 +02:00
|
|
|
|
2024-09-03 16:12:11 +02:00
|
|
|
input {
|
2024-04-30 00:48:47 +02:00
|
|
|
transform: rotate(270deg);
|
|
|
|
width: 4rem;
|
|
|
|
}
|
2024-09-03 16:12:11 +02:00
|
|
|
|
|
|
|
.pointer {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2023-08-27 22:20:34 +02:00
|
|
|
</style>
|