repod/src/components/Player/Bar.vue

91 lines
2.2 KiB
Vue
Raw Normal View History

2023-08-24 20:29:11 +00:00
<template>
2023-08-24 21:19:54 +00:00
<fragment>
<div v-if="episode" class="footer">
2023-08-27 10:45:19 +00:00
<NcProgressBar size="medium" :value="60" />
<div class="player">
<img :src="episode.episodeImage">
<div class="infos">
<a :href="episode.episodeLink" target="_blank">
<strong>{{ episode.episodeName }}</strong>
</a>
<a :href="podcastLink" target="_blank">
<i>{{ episode.podcastName }}</i>
</a>
</div>
<Pause v-if="!audio.paused" :size="50" @click="() => audio.play()" />
<Play v-if="audio.paused" :size="50" @click="() => audio.pause()" />
<div class="time">
<span class="current">0:00</span>
<span class="divider">/</span>
<span class="length">{{ audio.duration }}</span>
</div>
<div class="volume">
<VolumeHigh v-if="audio.volume > 0.7" :size="30" />
<VolumeLow v-if="audio.volume > 0 && audio.volume <= 0.3" :size="30" />
<VolumeMedium v-if="audio.volume > 0.3 && audio.volume <= 0.7" :size="30" />
<VolumeMute v-if="audio.volume == 0" :size="30" />
</div>
</div>
2023-08-24 21:19:54 +00:00
</div>
</fragment>
2023-08-24 20:29:11 +00:00
</template>
<script>
2023-08-27 10:45:19 +00:00
import { NcProgressBar } from '@nextcloud/vue'
import Pause from 'vue-material-design-icons/Pause.vue'
import Play from 'vue-material-design-icons/Play.vue'
import VolumeHigh from 'vue-material-design-icons/VolumeHigh.vue'
import VolumeLow from 'vue-material-design-icons/VolumeLow.vue'
import VolumeMedium from 'vue-material-design-icons/VolumeMedium.vue'
import VolumeMute from 'vue-material-design-icons/VolumeMute.vue'
2023-08-24 20:29:11 +00:00
export default {
name: 'Bar',
2023-08-27 10:45:19 +00:00
components: {
NcProgressBar,
Pause,
Play,
VolumeHigh,
VolumeLow,
VolumeMedium,
VolumeMute,
},
2023-08-24 20:29:11 +00:00
computed: {
2023-08-27 10:45:19 +00:00
audio() {
return new Audio(this.episode.episodeUrl)
},
2023-08-24 21:19:54 +00:00
episode() {
return this.$store.state.player.episode
2023-08-24 20:29:11 +00:00
},
2023-08-27 10:45:19 +00:00
podcastLink() {
return atob(this.$route.params.url)
},
2023-08-24 20:29:11 +00:00
},
}
</script>
<style scoped>
2023-08-24 21:19:54 +00:00
.footer {
2023-08-27 10:45:19 +00:00
background-color: rgba(66, 66, 66, .9);
2023-08-24 21:59:55 +00:00
bottom: 0;
2023-08-27 10:45:19 +00:00
height: 6rem;
2023-08-24 21:59:55 +00:00
right: 0;
2023-08-24 20:29:11 +00:00
position: absolute;
width: 100%;
2023-08-24 21:59:55 +00:00
z-index: 2000;
2023-08-24 20:29:11 +00:00
}
2023-08-27 10:45:19 +00:00
.infos {
display: flex;
flex-direction: column;
justify-content: center;
width: 44%;
}
.player {
display: flex;
gap: 1rem;
height: calc(6rem - 6px);
}
2023-08-24 20:29:11 +00:00
</style>