playpause cleanup

This commit is contained in:
Nikita Krupin 2022-06-08 14:05:00 -04:00
parent e2b91e5677
commit 0777b687ca
2 changed files with 73 additions and 67 deletions

View File

@ -38,8 +38,7 @@
<h4>{{ video.title }}</h4>
<div style="color: #aaa; font-size: 0.75rem">{{ video.channelName }}</div>
</div>
<!-- // TODO: merge the bottom 2 into 1 reusable component -->
<!-- // TODO: merge the bottom 2 into 1 reusable component and add animation -->
<v-btn
text
tile
@ -85,6 +84,7 @@
<captions />
<close />
<div>
<v-btn
fab
text
@ -116,7 +116,8 @@
<playpause
v-if="$refs.player"
:video="$refs.player"
@close="controls = false"
@pause="$refs.player.pause()"
@play="$refs.player.play(), (controls = false)"
/>
<v-btn
fab
@ -146,6 +147,7 @@
>
<v-icon size="1rem">mdi-fast-forward-5</v-icon>
</v-btn>
</div>
<watchtime
v-if="$refs.player"

View File

@ -6,8 +6,7 @@
style="position: absolute; top: calc(50% - 2rem); left: calc(50% - 2rem)"
color="white"
@click.stop="
(paused = !video.paused),
video.paused ? (video.play(), $emit('close')) : video.pause()
(paused = !video.paused), video.paused ? $emit('play') : $emit('pause')
"
>
<v-icon size="3.5rem">
@ -18,8 +17,13 @@
<script>
export default {
props: ["video"],
emits: ["close"],
props: {
video: {
type: Object,
required: true,
},
},
emits: ["play", "pause"],
data: () => ({
paused: false,
}),