repod/src/components/Player/Controls.vue

71 lines
1.4 KiB
Vue
Raw Normal View History

2023-08-27 22:20:34 +02:00
<template>
2023-08-28 21:25:12 +02:00
<div class="controls">
<Rewind10Icon
class="pointer rewind"
:size="20"
:title="t('repod', 'Rewind 10 seconds')"
@click="seek((currentTime ?? 0) - 10)" />
<PauseIcon
v-if="!paused"
class="pointer"
:size="50"
:title="t('repod', 'Pause')"
@click="pause" />
<PlayIcon
v-if="paused"
class="pointer"
:size="50"
:title="t('repod', 'Play')"
@click="play" />
<FastForward30Icon
class="pointer forward"
:size="20"
:title="t('repod', 'Fast forward 30 seconds')"
@click="seek((currentTime ?? 0) + 30)" />
2023-08-28 21:18:14 +02:00
</div>
2023-08-27 22:20:34 +02:00
</template>
<script lang="ts">
import { mapActions, mapState } from 'pinia'
import FastForward30Icon from 'vue-material-design-icons/FastForward30.vue'
2024-03-16 18:35:31 +01:00
import PauseIcon from 'vue-material-design-icons/Pause.vue'
import PlayIcon from 'vue-material-design-icons/Play.vue'
import Rewind10Icon from 'vue-material-design-icons/Rewind10.vue'
import { t } from '@nextcloud/l10n'
import { usePlayer } from '../../store/player.ts'
2023-08-27 22:20:34 +02:00
export default {
name: 'Controls',
components: {
FastForward30Icon,
2024-03-16 18:35:31 +01:00
PauseIcon,
PlayIcon,
Rewind10Icon,
2023-08-27 22:20:34 +02:00
},
computed: {
...mapState(usePlayer, ['currentTime', 'paused']),
},
methods: {
...mapActions(usePlayer, ['play', 'pause', 'seek']),
t,
2023-08-28 17:44:17 +02:00
},
2023-08-27 22:20:34 +02:00
}
</script>
2023-08-28 00:02:07 +02:00
<style scoped>
.controls {
display: flex;
}
2023-08-28 21:25:12 +02:00
.pointer {
cursor: pointer;
}
@media only screen and (max-width: 768px) {
.forward,
.rewind {
display: none;
}
}
2023-08-28 00:02:07 +02:00
</style>