Added play-pause icons swap.
Signed-off-by: Pavel Kirilin <win10@list.ru>
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
<script setup>
|
||||
import { ActionBar, ActionBarButton } from 'vant';
|
||||
import { postRequest } from '@/utils'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const is_playing = ref(false);
|
||||
|
||||
async function offsetRequest(offset, forward) {
|
||||
await postRequest(`/api/player/offset`, {
|
||||
@ -12,16 +14,28 @@ async function offsetRequest(offset, forward) {
|
||||
|
||||
async function playPauseRequest() {
|
||||
await postRequest(`/api/player/play-pause`)
|
||||
update_state()
|
||||
}
|
||||
|
||||
function update_state() {
|
||||
fetch('/api/player/playing').then((response) => {
|
||||
if (response.ok) {
|
||||
response.json().then((resp_json) => {
|
||||
is_playing.value = resp_json.playing
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
update_state()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ActionBar>
|
||||
<ActionBarButton icon="arrow-double-left" @click="offsetRequest(90, false)"></ActionBarButton>
|
||||
<ActionBarButton icon="arrow-double-left" @click="offsetRequest(85, false)"></ActionBarButton>
|
||||
<ActionBarButton icon="arrow-left" @click="offsetRequest(10, false)"></ActionBarButton>
|
||||
<ActionBarButton icon="play" @click="playPauseRequest()"></ActionBarButton>
|
||||
<ActionBarButton :icon="is_playing ? 'pause' : 'play'" @click="playPauseRequest()"></ActionBarButton>
|
||||
<ActionBarButton icon="arrow" @click="offsetRequest(10, true)"></ActionBarButton>
|
||||
<ActionBarButton icon="arrow-double-right" @click="offsetRequest(90, true)"></ActionBarButton>
|
||||
<ActionBarButton icon="arrow-double-right" @click="offsetRequest(85, true)"></ActionBarButton>
|
||||
</ActionBar>
|
||||
</template>
|
@ -17,14 +17,14 @@ async function kill(...names) {
|
||||
async function startWatching() {
|
||||
await postRequest("/api/start-watching")
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Space fill direction="vertical" :size="20">
|
||||
<Button type="warning" round size="large" @click="kill('mpv')">Убить MPV</Button>
|
||||
<Button type="danger" round size="large" @click="kill('awatch', 'mpv')">Убить awatch</Button>
|
||||
<Button type="primary" round size="large" :disabled="!can_watch" @click="startWatching">Начать потребление анимы</Button>
|
||||
<Button type="primary" round size="large" :disabled="!can_watch" @click="startWatching">Начать потребление
|
||||
анимы</Button>
|
||||
</Space>
|
||||
<PlayerComponent />
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user