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

131 lines
2.1 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-23 15:49:24 +00:00
:class="player.isPlaying ? 'pause' : 'play'" />
2020-10-22 11:53:40 +00:00
</div>
2020-10-17 18:06:57 +00:00
<div id="volumeicon" class="full" />
2020-10-21 08:43:37 +00:00
<input
2020-10-21 09:26:41 +00:00
v-model="sliderVal"
2020-10-21 08:43:37 +00:00
class="volume"
type="range"
name="volume"
min="0"
2020-10-21 09:26:41 +00:00
max="1"
step=".05"
2020-10-23 15:49:24 +00:00
value="this.volume"
2020-10-21 09:26:41 +00:00
@input="changeVolume">
2020-10-22 11:53:40 +00:00
<span class="stationMetadata" />
2020-10-17 18:06:57 +00:00
</div>
</template>
<script>
export default {
2020-10-22 11:53:40 +00:00
data: () => ({
2020-10-23 15:49:24 +00:00
sliderVal: 0,
2020-10-22 11:53:40 +00:00
}),
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() {
this.$emit('changeVolume', this.sliderVal)
},
},
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-22 11:53:40 +00:00
.station_metadata{
2020-10-21 08:43:37 +00:00
margin: 2px 20px 5px 20px;
padding-left: 5px;
white-space:nowrap;
overflow:hidden;
}
2020-10-17 18:06:57 +00:00
2020-10-21 08:43:37 +00:00
#volumeicon {
width: 20px;
height: 20px;
background-size: contain;
background-repeat: no-repeat;
position: relative;
left: 75px;
top: 14px;
}
2020-10-17 18:06:57 +00:00
2020-10-21 08:43:37 +00:00
#volumeicon.full {
2020-10-21 09:26:41 +00:00
background: red;
2020-10-21 08:43:37 +00:00
/* background-image: url('../img/sound_full.png'); */
}
2020-10-17 18:06:57 +00:00
2020-10-21 08:43:37 +00:00
#volumeicon.mid {
2020-10-21 09:26:41 +00:00
background: yellow;
2020-10-21 08:43:37 +00:00
/* background-image: url('../img/sound_mid.png'); */
}
2020-10-17 18:06:57 +00:00
2020-10-21 08:43:37 +00:00
#volumeicon.silent {
2020-10-21 09:26:41 +00:00
background: green;
2020-10-21 08:43:37 +00:00
/* background-image: url('../img/sound_silent.png'); */
}
2020-10-17 18:06:57 +00:00
2020-10-21 08:43:37 +00:00
.volume{
width: 170px;
display: inline-block;
position: relative;
left: 40px;
top: -7px;
}
2020-10-17 18:06:57 +00:00
</style>