2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
|
|
|
<div class="navbar-item">
|
|
|
|
<div class="level is-mobile">
|
|
|
|
<div class="level-left fd-expanded">
|
2022-02-19 00:39:14 -05:00
|
|
|
<div class="level-item" style="flex-grow: 0">
|
2020-05-03 01:10:30 -04:00
|
|
|
<a class="button is-white is-small">
|
2022-05-20 07:44:22 -04:00
|
|
|
<span class="icon fd-has-action" :class="{ 'has-text-grey-light': !output.selected }" @click="set_enabled">
|
2022-04-16 04:14:03 -04:00
|
|
|
<mdicon :name="type_class" size="18" :title="output.type" />
|
2020-05-03 01:10:30 -04:00
|
|
|
</span>
|
|
|
|
</a>
|
2018-08-11 01:47:10 -04:00
|
|
|
</div>
|
|
|
|
<div class="level-item fd-expanded">
|
|
|
|
<div class="fd-expanded">
|
2022-05-20 07:44:22 -04:00
|
|
|
<p class="heading" :class="{ 'has-text-grey-light': !output.selected }" v-text="output.name" />
|
|
|
|
<Slider v-model="volume" :min="0" :max="100" :step="1" :tooltips="false" :disabled="!output.selected" :classes="{ target: 'slider' }" @change="set_volume" />
|
2018-08-11 01:47:10 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 00:18:01 -05:00
|
|
|
import Slider from '@vueform/slider'
|
2018-08-11 01:47:10 -04:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
2019-07-06 10:03:09 -04:00
|
|
|
name: 'NavbarItemOutput',
|
2022-02-19 00:39:14 -05:00
|
|
|
components: {
|
2022-02-19 00:18:01 -05:00
|
|
|
Slider
|
2022-02-19 00:39:14 -05:00
|
|
|
},
|
2018-08-11 01:47:10 -04:00
|
|
|
|
2020-04-11 13:43:53 -04:00
|
|
|
props: ['output'],
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
type_class() {
|
2021-01-11 13:47:27 -05:00
|
|
|
if (this.output.type.startsWith('AirPlay')) {
|
2022-04-16 04:14:03 -04:00
|
|
|
return 'cast-variant'
|
2020-05-03 01:10:30 -04:00
|
|
|
} else if (this.output.type === 'Chromecast') {
|
2022-04-16 04:14:03 -04:00
|
|
|
return 'cast'
|
2018-08-11 01:47:10 -04:00
|
|
|
} else if (this.output.type === 'fifo') {
|
2022-04-16 04:14:03 -04:00
|
|
|
return 'pipe'
|
2018-08-11 01:47:10 -04:00
|
|
|
} else {
|
2022-04-16 04:14:03 -04:00
|
|
|
return 'server'
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
volume() {
|
2018-08-11 01:47:10 -04:00
|
|
|
return this.output.selected ? this.output.volume : 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
play_next: function () {
|
|
|
|
webapi.player_next()
|
|
|
|
},
|
|
|
|
|
|
|
|
set_volume: function (newVolume) {
|
|
|
|
webapi.player_output_volume(this.output.id, newVolume)
|
|
|
|
},
|
|
|
|
|
|
|
|
set_enabled: function () {
|
|
|
|
const values = {
|
2020-04-11 13:43:53 -04:00
|
|
|
selected: !this.output.selected
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
webapi.output_update(this.output.id, values)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|