mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2024-12-22 13:22:58 -05:00
feat(video): added theatre mode
This commit is contained in:
parent
caeb85a77b
commit
2681bfe10f
5 changed files with 56 additions and 11 deletions
28
src/components/TheatreModeToggle.vue
Normal file
28
src/components/TheatreModeToggle.vue
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<template>
|
||||||
|
<button @click="toggleTheatreMode" class="px-2 py-1.5 rounded-lg bg-purple">
|
||||||
|
<v-icon name="fa-expand"></v-icon>
|
||||||
|
<span>{{ isTheatreMode ? 'Exit Theatre Mode' : 'Theatre Mode' }}</span>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
emits: ['toggle'],
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const isTheatreMode = ref(false)
|
||||||
|
|
||||||
|
function toggleTheatreMode() {
|
||||||
|
isTheatreMode.value = !isTheatreMode.value
|
||||||
|
emit('toggle', isTheatreMode.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
isTheatreMode,
|
||||||
|
toggleTheatreMode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -36,7 +36,8 @@ import {
|
||||||
FaShareAlt,
|
FaShareAlt,
|
||||||
IoCloseSharp,
|
IoCloseSharp,
|
||||||
MdDownloadRound,
|
MdDownloadRound,
|
||||||
IoPerson
|
IoPerson,
|
||||||
|
FaExpand
|
||||||
} from 'oh-vue-icons/icons'
|
} from 'oh-vue-icons/icons'
|
||||||
|
|
||||||
addIcons(
|
addIcons(
|
||||||
|
@ -55,7 +56,8 @@ addIcons(
|
||||||
FaShareAlt,
|
FaShareAlt,
|
||||||
IoCloseSharp,
|
IoCloseSharp,
|
||||||
MdDownloadRound,
|
MdDownloadRound,
|
||||||
IoPerson
|
IoPerson,
|
||||||
|
FaExpand
|
||||||
)
|
)
|
||||||
|
|
||||||
app.component('v-icon', OhVueIcon)
|
app.component('v-icon', OhVueIcon)
|
||||||
|
|
|
@ -9,11 +9,11 @@ import LoadingScreen from '@/components/LoadingScreen.vue'
|
||||||
import AboutTab from '@/components/user/AboutTab.vue'
|
import AboutTab from '@/components/user/AboutTab.vue'
|
||||||
import ShareModal from '@/components/popups/ShareButtonModal.vue'
|
import ShareModal from '@/components/popups/ShareButtonModal.vue'
|
||||||
import VueTitle from '@/components/VueTitle.vue'
|
import VueTitle from '@/components/VueTitle.vue'
|
||||||
|
import TheatreModeToggle from '@/components/TheatreModeToggle.vue'
|
||||||
|
|
||||||
import type { Video } from '@/types'
|
import type { Video } from '@/types'
|
||||||
import { truncate, abbreviate, getEndpoint } from '@/mixins'
|
import { truncate, abbreviate, getEndpoint } from '@/mixins'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['rootBackendUrl'],
|
inject: ['rootBackendUrl'],
|
||||||
async setup() {
|
async setup() {
|
||||||
|
@ -51,7 +51,8 @@ export default {
|
||||||
videoOptions,
|
videoOptions,
|
||||||
time: ref(0),
|
time: ref(0),
|
||||||
srcUrl,
|
srcUrl,
|
||||||
shareModalVisible: ref(false)
|
shareModalVisible: ref(false),
|
||||||
|
isTheatreMode: ref(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
@ -72,13 +73,17 @@ export default {
|
||||||
LoadingScreen,
|
LoadingScreen,
|
||||||
AboutTab,
|
AboutTab,
|
||||||
ShareModal,
|
ShareModal,
|
||||||
VueTitle
|
VueTitle,
|
||||||
|
TheatreModeToggle
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
truncate,
|
truncate,
|
||||||
abbreviate,
|
abbreviate,
|
||||||
toggleShareModal() {
|
toggleShareModal() {
|
||||||
this.shareModalVisible = !this.shareModalVisible
|
this.shareModalVisible = !this.shareModalVisible
|
||||||
|
},
|
||||||
|
toggleTheatreMode() {
|
||||||
|
this.isTheatreMode = !this.isTheatreMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +100,10 @@ export default {
|
||||||
>
|
>
|
||||||
<VueTitle :title=" 'Clip - ' + data.title"></VueTitle>
|
<VueTitle :title=" 'Clip - ' + data.title"></VueTitle>
|
||||||
<div
|
<div
|
||||||
class="flex bg-crust flex-col p-6 rounded-lg w-[99vw] md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] text-contrast"
|
:class="[
|
||||||
|
'flex bg-crust flex-col p-6 rounded-lg w-[99vw] text-contrast',
|
||||||
|
isTheatreMode ? 'md:max-w-[95rem] lg:max-w-[100rem] xl:max-w-[120rem] 2x:max-w-[140rem]' : 'md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] xl:max-w-[80rem] 2x:max-w-[90rem]'
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<div class="w-full mx-auto rounded-lg mb-5">
|
<div class="w-full mx-auto rounded-lg mb-5">
|
||||||
<video-player :options="videoOptions"> </video-player>
|
<video-player :options="videoOptions"> </video-player>
|
||||||
|
@ -130,12 +138,14 @@ export default {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-x-1">
|
<div class="space-x-1">
|
||||||
|
<button @click="toggleTheatreMode" class="px-2 py-1.5 rounded-lg bg-purple">
|
||||||
|
<v-icon name="fa-expand"></v-icon>
|
||||||
|
</button>
|
||||||
<a :href="srcUrl" download>
|
<a :href="srcUrl" download>
|
||||||
<button class="px-2 py-1.5 rounded-lg bg-purple">
|
<button class="px-2 py-1.5 rounded-lg bg-purple">
|
||||||
<v-icon name="md-download-round"></v-icon>
|
<v-icon name="md-download-round"></v-icon>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<button @click="toggleShareModal" class="px-2 py-1.5 rounded-lg bg-purple">
|
<button @click="toggleShareModal" class="px-2 py-1.5 rounded-lg bg-purple">
|
||||||
<v-icon name="fa-share-alt"></v-icon>
|
<v-icon name="fa-share-alt"></v-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -102,7 +102,10 @@ export default {
|
||||||
>
|
>
|
||||||
<vue-title :title="data.username"></vue-title>
|
<vue-title :title="data.username"></vue-title>
|
||||||
<div
|
<div
|
||||||
class="flex bg-crust flex-col p-6 rounded-lg w-[99vw] md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] text-contrast"
|
:class="[
|
||||||
|
'flex bg-crust flex-col p-6 rounded-lg w-[99vw] text-contrast',
|
||||||
|
isTheatreMode ? 'md:max-w-[95rem] lg:max-w-[100rem] xl:max-w-[120rem] 2x:max-w-[140rem]' : 'md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] xl:max-w-[80rem] 2x:max-w-[90rem]'
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<div v-if="data.isLive" class="w-full mx-auto rounded-lg mb-5">
|
<div v-if="data.isLive" class="w-full mx-auto rounded-lg mb-5">
|
||||||
<video-player v-if="Boolean($route.query['audio-only']) === false" :options="videoOptions">
|
<video-player v-if="Boolean($route.query['audio-only']) === false" :options="videoOptions">
|
||||||
|
|
|
@ -98,11 +98,13 @@ export default {
|
||||||
>
|
>
|
||||||
<vue-title :title="'VOD - ' + data.title"></vue-title>
|
<vue-title :title="'VOD - ' + data.title"></vue-title>
|
||||||
<div
|
<div
|
||||||
class="flex bg-crust flex-col p-6 rounded-lg w-[99vw] md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] text-contrast"
|
:class="[
|
||||||
|
'flex bg-crust flex-col p-6 rounded-lg w-[99vw] text-contrast',
|
||||||
|
isTheatreMode ? 'md:max-w-[95rem] lg:max-w-[100rem] xl:max-w-[120rem] 2x:max-w-[140rem]' : 'md:max-w-prose md:min-w-[65ch] lg:max-w-[70rem] xl:max-w-[80rem] 2x:max-w-[90rem]'
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<div class="w-full mx-auto rounded-lg mb-5">
|
<div class="w-full mx-auto rounded-lg mb-5">
|
||||||
<video-player :options="videoOptions" @PlayerTimeUpdate="handlePlayerTimeUpdate">
|
<video-player :options="videoOptions"> </video-player>
|
||||||
</video-player>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-full flex-wrap md:p-3">
|
<div class="w-full flex-wrap md:p-3">
|
||||||
|
|
Loading…
Reference in a new issue