Skip to content

A self-hosted media server and file management system

ambient video and video player size fix

aminnausin4f1d0db9e51e
diff --git a/resources/js/components/video/VideoAmbientPlayer.vue b/resources/js/components/video/VideoAmbientPlayer.vue
index 7faf6e9f..498de8c7 100755
--- a/resources/js/components/video/VideoAmbientPlayer.vue
+++ b/resources/js/components/video/VideoAmbientPlayer.vue
@@ -1,11 +1,13 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
+import { useContentStore } from '@/stores/ContentStore';
import { useAppStore } from '@/stores/AppStore';
import { storeToRefs } from 'pinia';
import VideoPlayer from '@/components/video/VideoPlayer.vue';
const { lightMode, ambientMode } = storeToRefs(useAppStore());
+const { stateVideo } = storeToRefs(useContentStore());
const container = ref<null | HTMLElement>(null);
const player = ref<null | HTMLVideoElement>(null);
@@ -15,6 +17,7 @@ const ctx = ref<null | CanvasRenderingContext2D>(null);
const videoPlayer = useTemplateRef('video-player');
const isAudio = ref(false);
+const adjustTimeout = ref<null | number>(null);
const draw = () => {
if (!ctx.value || !player.value || !canvas.value) return;
@@ -82,7 +85,16 @@ watch(player, (newVal) => {
}
});
-watch(() => player.value?.src, adjustOverlayDiv);
+watch(
+ () => stateVideo.value,
+ () => {
+ if (adjustTimeout.value) clearTimeout(adjustTimeout.value);
+
+ adjustTimeout.value = setTimeout(() => {
+ adjustOverlayDiv();
+ }, 1000);
+ },
+);
</script>
<template>
diff --git a/resources/js/components/video/VideoInfoPanel.vue b/resources/js/components/video/VideoInfoPanel.vue
index ad97e5d0..9ebbefe6 100755
--- a/resources/js/components/video/VideoInfoPanel.vue
+++ b/resources/js/components/video/VideoInfoPanel.vue
@@ -83,16 +83,16 @@ watch(
<template>
<div class="flex flex-col sm:flex-row gap-2 sm:gap-4 p-3 w-full rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-primary-800 z-[3]">
- <div id="mp4-header-mobile" class="flex items-center justify-between w-full sm:hidden gap-2 flex-wrap">
- <h2 class="text-xl font-medium line-clamp-1 capitalize">
+ <div id="mp4-header-mobile" class="flex items-center justify-between w-full sm:hidden flex-wrap">
+ <h2 class="text-xl font-medium truncate capitalize">
{{ metaData?.fields.title ?? '[File Not Found]' }}
</h2>
- <span class="flex gap-1 flex-row flex-wrap h-[22px] overflow-hidden">
+ <span v-if="(stateVideo?.video_tags?.length ?? 0) > 0" :class="`flex gap-1 flex-row flex-wrap h-[22px] overflow-hidden`">
<ChipTag v-for="(tag, index) in stateVideo?.video_tags" v-bind:key="index" :label="tag.name" />
</span>
</div>
- <div id="mp4-description" class="flex gap-4 sm:flex-1 max-w-full">
+ <div id="mp4-description" class="flex gap-4 sm:flex-1 min-w-0">
<div class="h-32 my-auto object-cover rounded-md shadow-md aspect-2/3 mb-auto relative group">
<img
id="folder-thumbnail"
@@ -119,8 +119,8 @@ watch(
</template>
</ButtonIcon>
</div>
- <div class="flex flex-col gap-2 w-full group">
- <h2 id="mp4-title" class="text-xl font-medium line-clamp-1 capitalize hidden sm:block h-8">
+ <div class="flex flex-col gap-2 flex-1 min-w-0 w-full group">
+ <h2 id="mp4-title" class="text-xl font-medium truncate capitalize hidden sm:block h-8" :title="metaData?.fields.title ?? 'no file was found at this location'">
{{ metaData?.fields.title ?? '[File Not Found]' }}
</h2>
<HoverCard :content="metaData?.fields?.description ?? defaultDescription" :hover-card-delay="800" :margin="10">
diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vue
index 29c5a08e..08881f5e 100755
--- a/resources/js/components/video/VideoPlayer.vue
+++ b/resources/js/components/video/VideoPlayer.vue
@@ -315,7 +315,7 @@ defineExpose({
ref="player"
style="z-index: 3"
:src="stateVideo?.path ? `../${stateVideo?.path}` : ''"
- :class="`relative focus:outline-none object-contain hover:cursor-pointer ${isLoading || !stateVideo?.path ? 'aspect-video' : isAudio ? 'max-h-[60vh]' : ''}`"
+ :class="`relative focus:outline-none object-contain hover:cursor-pointer ${isLoading || !stateVideo?.path ? 'aspect-video' : 'max-h-[60vh]'}`"
:poster="isAudio ? audioPoster : ''"
@play="onPlayerPlay"
@pause="onPlayerPause"