nextcloud-app-radio/src/components/Player.vue

138 lines
2.2 KiB
Vue
Raw Normal View History

2020-10-17 18:06:57 +00:00
<template>
<div id="app-settings">
2020-10-22 11:53:40 +00:00
<div
class="wrap"
2020-10-23 15:49:24 +00:00
:class="{ buffering: player.isBuffering }">
2020-10-22 11:53:40 +00:00
<button
class="player"
2020-10-26 14:51:22 +00:00
:class="player.isPlaying ? 'pause' : 'play'"
@click="togglePlay" />
2020-10-22 11:53:40 +00:00
</div>
2020-10-25 09:41:19 +00:00
<div
class="volumeIcon"
2020-10-25 09:53:49 +00:00
:class="player.volume == 0 ? 'volumeMute' : 'volumeFull'"
2020-10-25 09:51:08 +00:00
@click="toggleMute" />
2020-10-21 08:43:37 +00:00
<input
class="volume"
type="range"
name="volume"
min="0"
2020-10-21 09:26:41 +00:00
max="1"
step=".05"
2020-10-25 09:03:23 +00:00
:value="player.volume"
2020-10-25 09:23:31 +00:00
@input="changeVolume($event)">
2020-10-26 15:41:58 +00:00
<span class="playerMetadata">
{{ player.title }}
</span>
2020-10-17 18:06:57 +00:00
</div>
</template>
<script>
export default {
2020-10-23 20:18:05 +00:00
computed: {
player() {
return this.$store.state.player
},
},
2020-10-21 09:26:41 +00:00
methods: {
changeVolume() {
2020-10-25 09:23:31 +00:00
this.$store.dispatch('changeVolume', event.target.value)
2020-10-21 09:26:41 +00:00
},
2020-10-25 09:51:08 +00:00
toggleMute() {
this.$store.dispatch('toggleMute')
},
2020-10-26 14:51:22 +00:00
togglePlay() {
this.$store.dispatch('togglePlay')
},
2020-10-21 09:26:41 +00:00
},
2020-10-17 18:06:57 +00:00
}
</script>
<style>
2020-10-22 11:53:40 +00:00
.wrap {
background: var(--color-main-background);
border: 3px solid #0082c9;
float: left;
border-radius: 50%;
margin: 10px;
}
.player{
2020-10-21 08:43:37 +00:00
height:50px;
width: 50px;
2020-10-22 11:53:40 +00:00
background-color: #0082c9;
mask-repeat: no-repeat;
mask-size: 55%;
mask-position: 70% 50%;
}
.play{
mask-image: var(--icon-play-000);
transition: mask-image 0.4s ease-in-out;
}
.pause{
mask-image: var(--icon-pause-000);
mask-position: 58% 50%;
transition: mask-image 0.4s ease-in-out;
2020-10-21 08:43:37 +00:00
}
2020-10-17 18:06:57 +00:00
2020-10-21 08:43:37 +00:00
.buffering {
2020-10-22 11:53:40 +00:00
border: 3px solid #0082c9;
animation: buffering 2s infinite linear;
2020-10-21 08:43:37 +00:00
}
2020-10-17 18:06:57 +00:00
2020-10-22 11:53:40 +00:00
@keyframes buffering {
0% {
border-color: #0082c9;
}
50% {
border-color: var(--color-main-background);
}
100% {
border-color: #0082c9;
}
}
2020-10-17 18:06:57 +00:00
2020-10-26 15:41:58 +00:00
.playerMetadata{
white-space: nowrap;
overflow: hidden;
background: red;
position: relative;
2020-10-21 08:43:37 +00:00
}
2020-10-17 18:06:57 +00:00
2020-10-25 09:37:48 +00:00
.volumeIcon {
width: 25px;
height: 25px;
2020-10-21 08:43:37 +00:00
position: relative;
2020-10-25 09:37:48 +00:00
left: 85px;
top: 20px;
2020-10-25 09:51:08 +00:00
cursor: pointer;
2020-10-21 08:43:37 +00:00
}
2020-10-17 18:06:57 +00:00
2020-10-25 09:37:48 +00:00
.volumeFull {
background-color: #0082c9;
mask-repeat: no-repeat;
mask-size: 100%;
mask-image: var(--icon-sound-000);
2020-10-21 08:43:37 +00:00
}
2020-10-17 18:06:57 +00:00
2020-10-25 09:41:19 +00:00
.volumeMute {
background-color: #0082c9;
mask-repeat: no-repeat;
mask-size: 100%;
mask-image: var(--icon-sound-off-000);
}
2020-10-21 08:43:37 +00:00
.volume{
2020-10-26 14:51:22 +00:00
width: 165px;
2020-10-21 08:43:37 +00:00
display: inline-block;
position: relative;
left: 40px;
2020-10-25 09:37:48 +00:00
top: -12px;
2020-10-21 08:43:37 +00:00
}
2020-10-17 18:06:57 +00:00
</style>