11<script setup lang="ts">
22import type { FolderResource , VideoResource } from ' @/types/resources' ;
3- import { type ContextMenuItem , type PopoverItem , MediaType } from ' @/types/types' ;
4- import type { Series } from ' @/types/model' ;
3+ import type { ContextMenuItem , PopoverItem } from ' @/types/types' ;
54
65import { getScreenSize , handleStorageURL , isInputLikeElement , isMobileDevice , toFormattedDate , toFormattedDuration } from ' @/service/util' ;
76import { computed , nextTick , onMounted , onUnmounted , ref , useTemplateRef , watch , type ComputedRef , type Ref } from ' vue' ;
@@ -13,6 +12,7 @@ import { useAuthStore } from '@/stores/AuthStore';
1312import { useAppStore } from ' @/stores/AppStore' ;
1413import { storeToRefs } from ' pinia' ;
1514import { getMediaUrl } from ' @/service/api' ;
15+ import { MediaType } from ' @/types/types' ;
1616import { useRouter } from ' vue-router' ;
1717import { toast } from ' @/service/toaster/toastService' ;
1818
@@ -49,6 +49,7 @@ import ProiconsCancel from '~icons/proicons/cancel';
4949import ProiconsPlay from ' ~icons/proicons/play' ;
5050import MagePlaylist from ' ~icons/mage/playlist' ;
5151import CircumTimer from ' ~icons/circum/timer' ;
52+ import { onSeek } from ' @/service/video/seekBus' ;
5253
5354/**
5455 * Z Index Layout:
@@ -73,7 +74,7 @@ const { setContextMenu } = useAppStore();
7374const { userData } = storeToRefs (useAuthStore ());
7475const { stateVideo, stateFolder, nextVideoURL, previousVideoURL } = storeToRefs (useContentStore ()) as unknown as {
7576 stateVideo: Ref <VideoResource >;
76- stateFolder: Ref <FolderResource | { id ? : number ; name ? : string ; series ? : Series ; path ? : string } >;
77+ stateFolder: Ref <FolderResource >;
7778 nextVideoURL: ComputedRef <string >;
7879 previousVideoURL: ComputedRef <string >;
7980};
@@ -164,7 +165,7 @@ const keyBinds = computed(() => {
164165 play: ` ${isPaused .value ? ' Play' : ' Pause' }${keys .play } ` ,
165166 next: ` Play Next${keys .next } ` ,
166167 fullscreen: ` ${isFullScreen .value ? ' Exit Full Screen' : ' Full Screen' }${keys .fullscreen } ` ,
167- lyrics: ` ${isShowingLyrics .value ? ' Disable' : ' Enable' } ${isAudio .value ? ' Lyrics' : ' Captions' }${keys .lyrics } ` ,
168+ lyrics: ` ${isShowingLyrics .value ? ' Disable' : ' Enable' } ${isAudio .value || stateFolder . value . is_majority_audio ? ' Lyrics' : ' Captions' }${keys .lyrics } ` ,
168169 };
169170});
170171
@@ -236,7 +237,7 @@ const videoPopoverItems = computed(() => {
236237 selectedIcon: ProiconsCheckmark ,
237238 selected: isShowingLyrics .value ?? false ,
238239 selectedIconStyle: ' text-purple-600 stroke-none' ,
239- disabled: getScreenSize () !== ' default' || isAudio .value ,
240+ disabled: getScreenSize () !== ' default' || isAudio .value || stateFolder . value . is_majority_audio ,
240241 action : () => {
241242 isShowingLyrics .value = ! isShowingLyrics .value ;
242243 },
@@ -249,7 +250,7 @@ const videoPopoverItems = computed(() => {
249250 selectedIcon: ProiconsCheckmark ,
250251 selected: isShowingLyrics .value ?? false ,
251252 selectedIconStyle: ' text-purple-600 stroke-none' ,
252- disabled: getScreenSize () !== ' default' || ! isAudio .value ,
253+ disabled: getScreenSize () !== ' default' || ( ! isAudio .value && ! stateFolder . value . is_majority_audio ) ,
253254 action : () => {
254255 isShowingLyrics .value = ! isShowingLyrics .value ;
255256 },
@@ -921,15 +922,19 @@ watch(isPictureInPicture, async (value) => {
921922
922923watch (stateVideo , initVideoPlayer );
923924
925+ let unSub: () => boolean ;
926+
924927onMounted (() => {
925928 if (document .pictureInPictureElement ) document .exitPictureInPicture ();
926929 handleLoadSavedVolume ();
927930 handleMediaSessionEvents ();
928931 window .addEventListener (' keydown' , handleKeyBinds );
929932 document .addEventListener (' fullscreenchange' , handleFullScreenChange );
933+ unSub = onSeek (handleManualSeek );
930934});
931935
932936onUnmounted (() => {
937+ unSub ();
933938 window .removeEventListener (' keydown' , handleKeyBinds );
934939 document .removeEventListener (' fullscreenchange' , handleFullScreenChange );
935940 debouncedCacheVolume .cancel ();
@@ -1234,7 +1239,7 @@ defineExpose({
12341239 :controls =" isShowingControls "
12351240 :offset =" videoButtonOffset "
12361241 >
1237- <template #icon v-if =" isAudio " >
1242+ <template #icon v-if =" isAudio || stateFolder . is_majority_audio " >
12381243 <TablerMicrophone2 v-if =" isShowingLyrics " class="w-4 h-4 [&>*]:stroke-[1.4px]" />
12391244 <TablerMicrophone2Off v-else class="w-4 h-4 [&>*]:stroke-[1.4px]" />
12401245 </template >
@@ -1358,9 +1363,10 @@ defineExpose({
13581363 leave-active-class="transition ease-in duration-300"
13591364 leave-from-class="translate-y-0 opacity-100"
13601365 leave-to-class="translate-y-full opacity-0"
1361- ><div :class="`absolute w-full h-full top-0 flex transition-all opacity-0`" style="z-index: 5" v-show="isShowingLyrics">
1366+ >
1367+ <div :class="`absolute w-full h-full top-0 flex transition-all opacity-0`" style="z-index: 5" v-show="isShowingLyrics">
13621368 <VideoLyrics
1363- v-if="isAudio"
1369+ v-if="isAudio || stateFolder.is_majority_audio "
13641370 @seek="handleManualSeek"
13651371 :raw-lyrics="stateVideo?.metadata?.lyrics ?? ''"
13661372 :time-duration="timeDuration"
@@ -1443,7 +1449,11 @@ defineExpose({
14431449 leave-active-class="transition ease-in duration-300"
14441450 leave-from-class="opacity-100"
14451451 leave-to-class="opacity-0"
1446- ><div :class="`absolute w-full h-full top-0 transition-all backdrop-blur-lg bg-neutral-950/10`" style="z-index: 3" v-show="isAudio && isShowingLyrics"></div>
1452+ ><div
1453+ :class="`absolute w-full h-full top-0 transition-all backdrop-blur-lg bg-neutral-950/10`"
1454+ style="z-index: 3"
1455+ v-show="(isAudio || stateFolder.is_majority_audio) && isShowingLyrics"
1456+ ></div>
14471457 </Transition >
14481458 </section >
14491459 <!-- Is a blurred copy of the thumbnail or poster as a backdrop to the clear poster -->
0 commit comments