2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
|
|
|
<a v-on:click="toggle_play_pause">
|
2018-12-30 02:53:40 -05:00
|
|
|
<span class="icon"><i class="mdi" v-bind:class="[icon_style, { 'mdi-play': !is_playing, 'mdi-pause': is_playing && is_pause_allowed, 'mdi-stop': is_playing && !is_pause_allowed }]"></i></span>
|
2018-08-11 01:47:10 -04:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PlayerButtonPlayPause',
|
|
|
|
|
|
|
|
props: ['icon_style'],
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
is_playing () {
|
|
|
|
return this.$store.state.player.state === 'play'
|
2018-12-30 02:53:40 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
is_pause_allowed () {
|
2019-06-15 07:26:18 -04:00
|
|
|
return (this.$store.getters.now_playing &&
|
|
|
|
this.$store.getters.now_playing.data_kind !== 'pipe')
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
toggle_play_pause: function () {
|
2018-12-30 02:53:40 -05:00
|
|
|
if (this.is_playing && this.is_pause_allowed) {
|
2018-08-11 01:47:10 -04:00
|
|
|
webapi.player_pause()
|
2018-12-30 02:53:40 -05:00
|
|
|
} else if (this.is_playing && !this.is_pause_allowed) {
|
|
|
|
webapi.player_stop()
|
2018-08-11 01:47:10 -04:00
|
|
|
} else {
|
|
|
|
webapi.player_play()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|