2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
2022-05-29 12:49:00 -04:00
|
|
|
<nav
|
|
|
|
class="fd-bottom-navbar navbar is-white is-fixed-bottom"
|
|
|
|
:style="zindex"
|
|
|
|
:class="{
|
|
|
|
'is-transparent': is_now_playing_page,
|
|
|
|
'is-dark': !is_now_playing_page
|
|
|
|
}"
|
|
|
|
role="navigation"
|
|
|
|
aria-label="player controls"
|
|
|
|
>
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="navbar-brand is-flex-grow-1">
|
2020-04-18 00:57:55 -04:00
|
|
|
<!-- Link to queue -->
|
|
|
|
<navbar-item-link to="/" exact>
|
2022-06-15 13:24:51 -04:00
|
|
|
<span class="icon"><mdicon name="playlist-play" size="24" /></span>
|
2020-04-18 00:57:55 -04:00
|
|
|
</navbar-item-link>
|
|
|
|
<!-- Now playing artist/title (not visible on "now playing" page) -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<router-link
|
|
|
|
v-if="!is_now_playing_page"
|
|
|
|
to="/now-playing"
|
|
|
|
class="navbar-item is-expanded is-clipped"
|
|
|
|
active-class="is-active"
|
|
|
|
exact
|
|
|
|
>
|
2020-04-18 00:57:55 -04:00
|
|
|
<div class="is-clipped">
|
2018-08-11 01:47:10 -04:00
|
|
|
<p class="is-size-7 fd-is-text-clipped">
|
2022-05-20 07:44:22 -04:00
|
|
|
<strong v-text="now_playing.title" />
|
|
|
|
<br />
|
|
|
|
<span v-text="now_playing.artist" />
|
2022-05-29 12:49:00 -04:00
|
|
|
<span
|
|
|
|
v-if="now_playing.data_kind === 'url'"
|
|
|
|
v-text="
|
|
|
|
$t('navigation.now-playing', { album: now_playing.album })
|
|
|
|
"
|
|
|
|
/>
|
2018-08-11 01:47:10 -04:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</router-link>
|
2020-04-18 00:57:55 -04:00
|
|
|
<!-- Skip previous (not visible on "now playing" page) -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<player-button-previous
|
|
|
|
v-if="is_now_playing_page"
|
2023-06-11 02:44:45 -04:00
|
|
|
class="navbar-item ml-auto"
|
2022-05-29 12:49:00 -04:00
|
|
|
:icon_size="24"
|
|
|
|
/>
|
|
|
|
<player-button-seek-back
|
|
|
|
v-if="is_now_playing_page"
|
|
|
|
:seek_ms="10000"
|
|
|
|
class="navbar-item"
|
|
|
|
:icon_size="24"
|
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
<!-- Play/pause -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<player-button-play-pause
|
|
|
|
class="navbar-item"
|
|
|
|
:icon_size="36"
|
|
|
|
show_disabled_message
|
|
|
|
/>
|
|
|
|
<player-button-seek-forward
|
|
|
|
v-if="is_now_playing_page"
|
|
|
|
:seek_ms="30000"
|
|
|
|
class="navbar-item"
|
|
|
|
:icon_size="24"
|
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
<!-- Skip next (not visible on "now playing" page) -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<player-button-next
|
|
|
|
v-if="is_now_playing_page"
|
|
|
|
class="navbar-item"
|
|
|
|
:icon_size="24"
|
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
<!-- Player menu button (only visible on mobile and tablet) -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<a
|
2023-06-11 02:44:45 -04:00
|
|
|
class="navbar-item ml-auto is-hidden-desktop"
|
2022-05-29 12:49:00 -04:00
|
|
|
@click="show_player_menu = !show_player_menu"
|
|
|
|
>
|
2022-06-15 13:24:51 -04:00
|
|
|
<span class="icon"
|
|
|
|
><mdicon
|
|
|
|
:name="show_player_menu ? 'chevron-down' : 'chevron-up'"
|
|
|
|
size="18"
|
|
|
|
/></span>
|
2020-04-18 00:57:55 -04:00
|
|
|
</a>
|
|
|
|
<!-- Player menu dropup menu (only visible on desktop) -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<div
|
2023-06-11 02:44:45 -04:00
|
|
|
class="navbar-item has-dropdown has-dropdown-up ml-auto is-hidden-touch"
|
2022-05-29 12:49:00 -04:00
|
|
|
:class="{ 'is-active': show_player_menu }"
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
class="navbar-link is-arrowless"
|
|
|
|
@click="show_player_menu = !show_player_menu"
|
|
|
|
>
|
2022-06-15 13:24:51 -04:00
|
|
|
<span class="icon"
|
|
|
|
><mdicon
|
|
|
|
:name="show_player_menu ? 'chevron-down' : 'chevron-up'"
|
|
|
|
size="18"
|
|
|
|
/></span>
|
2020-04-18 00:57:55 -04:00
|
|
|
</a>
|
2022-05-29 12:49:00 -04:00
|
|
|
<div
|
|
|
|
class="navbar-dropdown is-right is-boxed"
|
|
|
|
style="margin-right: 6px; margin-bottom: 6px; border-radius: 6px"
|
|
|
|
>
|
2020-04-18 00:57:55 -04:00
|
|
|
<div class="navbar-item">
|
|
|
|
<!-- Outputs: master volume -->
|
|
|
|
<div class="level is-mobile">
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-left is-flex-grow-1">
|
|
|
|
<div class="level-item is-flex-grow-0">
|
2022-05-29 12:49:00 -04:00
|
|
|
<a
|
|
|
|
class="button is-white is-small"
|
|
|
|
@click="toggle_mute_volume"
|
|
|
|
>
|
2022-06-15 13:24:51 -04:00
|
|
|
<span class="icon"
|
|
|
|
><mdicon
|
|
|
|
:name="player.volume > 0 ? 'volume-high' : 'volume-off'"
|
|
|
|
size="18"
|
|
|
|
/></span>
|
2020-04-18 00:57:55 -04:00
|
|
|
</a>
|
|
|
|
</div>
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-item">
|
|
|
|
<div>
|
2022-05-20 07:44:22 -04:00
|
|
|
<p class="heading" v-text="$t('navigation.volume')" />
|
2023-06-21 09:14:17 -04:00
|
|
|
<input
|
2022-05-29 12:49:00 -04:00
|
|
|
v-model="player.volume"
|
2023-06-21 09:14:17 -04:00
|
|
|
class="slider"
|
|
|
|
max="100"
|
|
|
|
type="range"
|
|
|
|
:style="{ '--ratio': player.volume / 100 }"
|
|
|
|
@change="change_volume"
|
2022-05-29 12:49:00 -04:00
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Outputs: master volume -->
|
2022-02-19 00:39:14 -05:00
|
|
|
<hr class="fd-navbar-divider" />
|
2022-05-29 12:49:00 -04:00
|
|
|
<navbar-item-output
|
|
|
|
v-for="output in outputs"
|
|
|
|
:key="output.id"
|
|
|
|
:output="output"
|
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
<!-- Outputs: stream volume -->
|
2022-02-19 00:39:14 -05:00
|
|
|
<hr class="fd-navbar-divider" />
|
2020-04-18 00:57:55 -04:00
|
|
|
<div class="navbar-item">
|
|
|
|
<div class="level is-mobile">
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-left is-flex-grow-1">
|
|
|
|
<div class="level-item is-flex-grow-0">
|
2022-05-29 12:49:00 -04:00
|
|
|
<a
|
|
|
|
class="button is-white is-small"
|
|
|
|
:class="{ 'is-loading': loading }"
|
2022-06-15 13:24:51 -04:00
|
|
|
><span
|
2023-06-10 13:22:29 -04:00
|
|
|
class="icon is-clickable"
|
2022-05-29 12:49:00 -04:00
|
|
|
:class="{
|
|
|
|
'has-text-grey-light': !playing && !loading,
|
|
|
|
'is-loading': loading
|
|
|
|
}"
|
|
|
|
@click="togglePlay"
|
2022-06-15 13:24:51 -04:00
|
|
|
><mdicon name="broadcast" size="18"
|
|
|
|
/></span>
|
2022-05-20 07:44:22 -04:00
|
|
|
</a>
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-item">
|
|
|
|
<div class="is-flex-grow-1">
|
2022-05-29 12:49:00 -04:00
|
|
|
<p
|
|
|
|
class="heading"
|
|
|
|
:class="{ 'has-text-grey-light': !playing }"
|
|
|
|
>
|
2022-05-20 07:44:22 -04:00
|
|
|
<span v-text="$t('navigation.stream')" />
|
2023-06-24 09:10:33 -04:00
|
|
|
<a href="stream.mp3" class="ml-2" target="_blank"
|
2022-06-15 13:24:51 -04:00
|
|
|
><span class="icon"
|
|
|
|
><mdicon
|
|
|
|
name="open-in-new"
|
|
|
|
size="16"
|
|
|
|
style="vertical-align: middle"
|
|
|
|
/></span>
|
2022-05-20 07:44:22 -04:00
|
|
|
</a>
|
2022-02-19 00:39:14 -05:00
|
|
|
</p>
|
2023-06-21 09:14:17 -04:00
|
|
|
<input
|
2022-05-29 12:49:00 -04:00
|
|
|
v-model="stream_volume"
|
|
|
|
:disabled="!playing"
|
2023-06-21 09:14:17 -04:00
|
|
|
class="slider"
|
|
|
|
:class="{ 'is-inactive': !playing }"
|
|
|
|
max="100"
|
|
|
|
type="range"
|
|
|
|
:style="{ '--ratio': stream_volume / 100 }"
|
|
|
|
@change="change_stream_volume"
|
2022-05-29 12:49:00 -04:00
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Playback controls -->
|
2022-02-19 00:39:14 -05:00
|
|
|
<hr class="fd-navbar-divider" />
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="navbar-item is-justify-content-center">
|
|
|
|
<div class="level">
|
2020-04-17 00:23:28 -04:00
|
|
|
<div class="level-item">
|
|
|
|
<div class="buttons has-addons">
|
2022-02-19 00:39:14 -05:00
|
|
|
<player-button-repeat class="button" />
|
|
|
|
<player-button-shuffle class="button" />
|
|
|
|
<player-button-consume class="button" />
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Player menu (only visible on mobile and tablet) -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<div
|
|
|
|
class="navbar-menu is-hidden-desktop"
|
|
|
|
:class="{ 'is-active': show_player_menu }"
|
|
|
|
>
|
2022-02-19 00:39:14 -05:00
|
|
|
<div class="navbar-start" />
|
2020-04-18 00:57:55 -04:00
|
|
|
<div class="navbar-end">
|
|
|
|
<!-- Repeat/shuffle/consume -->
|
|
|
|
<div class="navbar-item">
|
|
|
|
<div class="buttons is-centered">
|
2022-04-16 04:14:03 -04:00
|
|
|
<player-button-repeat class="button" :icon_size="18" />
|
|
|
|
<player-button-shuffle class="button" :icon_size="18" />
|
|
|
|
<player-button-consume class="button" :icon_size="18" />
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-02-19 00:39:14 -05:00
|
|
|
<hr class="fd-navbar-divider" />
|
2020-04-18 00:57:55 -04:00
|
|
|
<!-- Outputs: master volume -->
|
|
|
|
<div class="navbar-item">
|
|
|
|
<div class="level is-mobile">
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-left is-flex-grow-1">
|
|
|
|
<div class="level-item is-flex-grow-0">
|
2020-04-18 00:57:55 -04:00
|
|
|
<a class="button is-white is-small" @click="toggle_mute_volume">
|
2022-06-15 13:24:51 -04:00
|
|
|
<span class="icon"
|
|
|
|
><mdicon
|
|
|
|
:name="player.volume > 0 ? 'volume-high' : 'volume-off'"
|
|
|
|
size="18"
|
|
|
|
/></span>
|
2020-04-18 00:57:55 -04:00
|
|
|
</a>
|
|
|
|
</div>
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-item">
|
|
|
|
<div class="is-flex-grow-1">
|
2022-05-20 07:44:22 -04:00
|
|
|
<p class="heading" v-text="$t('navigation.volume')" />
|
2023-06-21 09:14:17 -04:00
|
|
|
<input
|
2022-05-29 12:49:00 -04:00
|
|
|
v-model="player.volume"
|
2023-06-21 09:14:17 -04:00
|
|
|
class="slider"
|
|
|
|
max="100"
|
|
|
|
type="range"
|
|
|
|
:style="{ '--ratio': player.volume / 100 }"
|
|
|
|
@change="change_volume"
|
2022-05-29 12:49:00 -04:00
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-17 00:23:28 -04:00
|
|
|
<!-- Outputs: speaker volumes -->
|
2022-05-29 12:49:00 -04:00
|
|
|
<navbar-item-output
|
|
|
|
v-for="output in outputs"
|
|
|
|
:key="output.id"
|
|
|
|
:output="output"
|
|
|
|
/>
|
2020-04-17 00:23:28 -04:00
|
|
|
<!-- Outputs: stream volume -->
|
2022-02-19 00:39:14 -05:00
|
|
|
<hr class="fd-navbar-divider" />
|
2023-06-21 09:14:17 -04:00
|
|
|
<div class="navbar-item mb-5">
|
2020-04-17 00:23:28 -04:00
|
|
|
<div class="level is-mobile">
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-left is-flex-grow-1">
|
|
|
|
<div class="level-item is-flex-grow-0">
|
2022-05-29 12:49:00 -04:00
|
|
|
<a
|
|
|
|
class="button is-white is-small"
|
|
|
|
:class="{ 'is-loading': loading }"
|
|
|
|
>
|
|
|
|
<span
|
2023-06-10 13:22:29 -04:00
|
|
|
class="icon is-clickable"
|
2022-05-29 12:49:00 -04:00
|
|
|
:class="{
|
|
|
|
'has-text-grey-light': !playing && !loading,
|
|
|
|
'is-loading': loading
|
|
|
|
}"
|
|
|
|
@click="togglePlay"
|
2022-06-15 13:24:51 -04:00
|
|
|
><mdicon name="radio-tower" size="16" />
|
2020-04-17 10:24:49 -04:00
|
|
|
</span>
|
|
|
|
</a>
|
2020-04-17 00:23:28 -04:00
|
|
|
</div>
|
2023-06-24 09:10:33 -04:00
|
|
|
<div class="level-item">
|
|
|
|
<div class="is-flex-grow-1">
|
2022-05-29 12:49:00 -04:00
|
|
|
<p
|
|
|
|
class="heading"
|
|
|
|
:class="{ 'has-text-grey-light': !playing }"
|
|
|
|
>
|
2022-05-20 07:44:22 -04:00
|
|
|
<span v-text="$t('navigation.stream')" />
|
2023-06-24 09:10:33 -04:00
|
|
|
<a href="stream.mp3" class="ml-2" target="_blank"
|
2022-06-15 13:24:51 -04:00
|
|
|
><span class="icon"
|
|
|
|
><mdicon
|
|
|
|
name="open-in-new"
|
|
|
|
size="16"
|
|
|
|
style="vertical-align: middle"
|
|
|
|
/></span>
|
2022-05-20 07:44:22 -04:00
|
|
|
</a>
|
2022-02-19 00:39:14 -05:00
|
|
|
</p>
|
2023-06-21 09:14:17 -04:00
|
|
|
<input
|
2022-05-29 12:49:00 -04:00
|
|
|
v-model="stream_volume"
|
|
|
|
:disabled="!playing"
|
2023-06-21 09:14:17 -04:00
|
|
|
class="slider"
|
|
|
|
:class="{ 'is-inactive': !playing }"
|
|
|
|
max="100"
|
|
|
|
type="range"
|
|
|
|
:style="{ '--ratio': stream_volume / 100 }"
|
|
|
|
@change="change_stream_volume"
|
2022-05-29 12:49:00 -04:00
|
|
|
/>
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-17 00:23:28 -04:00
|
|
|
</div>
|
2020-04-18 00:57:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-08-11 01:47:10 -04:00
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-04-18 00:57:55 -04:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
import _audio from '@/audio'
|
2022-02-19 00:18:01 -05:00
|
|
|
import NavbarItemLink from './NavbarItemLink.vue'
|
|
|
|
import NavbarItemOutput from './NavbarItemOutput.vue'
|
|
|
|
import PlayerButtonPlayPause from '@/components/PlayerButtonPlayPause.vue'
|
|
|
|
import PlayerButtonNext from '@/components/PlayerButtonNext.vue'
|
|
|
|
import PlayerButtonPrevious from '@/components/PlayerButtonPrevious.vue'
|
|
|
|
import PlayerButtonShuffle from '@/components/PlayerButtonShuffle.vue'
|
|
|
|
import PlayerButtonConsume from '@/components/PlayerButtonConsume.vue'
|
|
|
|
import PlayerButtonRepeat from '@/components/PlayerButtonRepeat.vue'
|
|
|
|
import PlayerButtonSeekBack from '@/components/PlayerButtonSeekBack.vue'
|
|
|
|
import PlayerButtonSeekForward from '@/components/PlayerButtonSeekForward.vue'
|
2020-04-18 00:57:55 -04:00
|
|
|
import * as types from '@/store/mutation_types'
|
2018-08-11 01:47:10 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'NavbarBottom',
|
2020-04-17 00:23:28 -04:00
|
|
|
components: {
|
|
|
|
NavbarItemLink,
|
|
|
|
NavbarItemOutput,
|
|
|
|
PlayerButtonPlayPause,
|
|
|
|
PlayerButtonNext,
|
|
|
|
PlayerButtonPrevious,
|
|
|
|
PlayerButtonShuffle,
|
|
|
|
PlayerButtonConsume,
|
|
|
|
PlayerButtonRepeat,
|
|
|
|
PlayerButtonSeekForward,
|
|
|
|
PlayerButtonSeekBack
|
|
|
|
},
|
2018-08-11 01:47:10 -04:00
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
data() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return {
|
|
|
|
old_volume: 0,
|
|
|
|
playing: false,
|
|
|
|
loading: false,
|
|
|
|
stream_volume: 10,
|
|
|
|
show_outputs_menu: false,
|
|
|
|
show_desktop_outputs_menu: false
|
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2020-04-18 00:57:55 -04:00
|
|
|
show_player_menu: {
|
2022-02-19 00:39:14 -05:00
|
|
|
get() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$store.state.show_player_menu
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
set(value) {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.$store.commit(types.SHOW_PLAYER_MENU, value)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
show_burger_menu() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$store.state.show_burger_menu
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
zindex() {
|
2020-04-18 00:57:55 -04:00
|
|
|
if (this.show_burger_menu) {
|
|
|
|
return 'z-index: 20'
|
|
|
|
}
|
|
|
|
return ''
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
now_playing() {
|
2018-08-11 01:47:10 -04:00
|
|
|
return this.$store.getters.now_playing
|
2020-04-18 00:57:55 -04:00
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
is_now_playing_page() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$route.path === '/now-playing'
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
outputs() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$store.state.outputs
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
player() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$store.state.player
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
config() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$store.state.config
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
2020-04-18 00:57:55 -04:00
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
watch: {
|
|
|
|
'$store.state.player.volume'() {
|
|
|
|
if (this.player.volume > 0) {
|
|
|
|
this.old_volume = this.player.volume
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
// On app mounted
|
2022-02-19 00:39:14 -05:00
|
|
|
mounted() {
|
|
|
|
this.setupAudio()
|
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
// On app destroyed
|
2022-02-19 00:39:14 -05:00
|
|
|
unmounted() {
|
|
|
|
this.closeAudio()
|
|
|
|
},
|
|
|
|
|
2020-04-18 00:57:55 -04:00
|
|
|
methods: {
|
2022-02-19 00:39:14 -05:00
|
|
|
on_click_outside_outputs() {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.show_outputs_menu = false
|
|
|
|
},
|
|
|
|
|
2023-06-21 09:14:17 -04:00
|
|
|
change_volume() {
|
|
|
|
webapi.player_volume(this.player.volume)
|
2020-04-18 00:57:55 -04:00
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
toggle_mute_volume() {
|
2023-06-21 09:14:17 -04:00
|
|
|
this.player.volume = this.player.volume > 0 ? 0 : this.old_volume
|
|
|
|
this.change_volume()
|
2020-04-18 00:57:55 -04:00
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
setupAudio() {
|
2020-04-18 00:57:55 -04:00
|
|
|
const a = _audio.setupAudio()
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
a.addEventListener('waiting', (e) => {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.playing = false
|
|
|
|
this.loading = true
|
|
|
|
})
|
2022-02-19 00:39:14 -05:00
|
|
|
a.addEventListener('playing', (e) => {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.playing = true
|
|
|
|
this.loading = false
|
|
|
|
})
|
2022-02-19 00:39:14 -05:00
|
|
|
a.addEventListener('ended', (e) => {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.playing = false
|
|
|
|
this.loading = false
|
|
|
|
})
|
2022-02-19 00:39:14 -05:00
|
|
|
a.addEventListener('error', (e) => {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.closeAudio()
|
2022-02-19 00:39:14 -05:00
|
|
|
this.$store.dispatch('add_notification', {
|
2022-05-20 07:44:22 -04:00
|
|
|
text: this.$t('navigation.stream-error'),
|
2022-02-19 00:39:14 -05:00
|
|
|
type: 'danger'
|
|
|
|
})
|
2020-04-18 00:57:55 -04:00
|
|
|
this.playing = false
|
|
|
|
this.loading = false
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
// Close active audio
|
|
|
|
closeAudio() {
|
2020-04-18 00:57:55 -04:00
|
|
|
_audio.stopAudio()
|
|
|
|
this.playing = false
|
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
playChannel() {
|
2020-04-18 00:57:55 -04:00
|
|
|
if (this.playing) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
const channel = '/stream.mp3'
|
|
|
|
this.loading = true
|
|
|
|
_audio.playSource(channel)
|
|
|
|
_audio.setVolume(this.stream_volume / 100)
|
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
togglePlay() {
|
2020-04-18 00:57:55 -04:00
|
|
|
if (this.loading) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (this.playing) {
|
|
|
|
return this.closeAudio()
|
|
|
|
}
|
|
|
|
return this.playChannel()
|
|
|
|
},
|
|
|
|
|
2023-06-21 09:14:17 -04:00
|
|
|
change_stream_volume() {
|
|
|
|
console.log(this.stream_volume)
|
2020-04-18 00:57:55 -04:00
|
|
|
_audio.setVolume(this.stream_volume / 100)
|
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|