Skip to content

A self-hosted media server and file management system

fix: lyric reset

aminnausin2355fd90708d
diff --git a/resources/js/components/video/VideoLyrics.vue b/resources/js/components/video/VideoLyrics.vue
index 15cd4c37..0e96a14a 100644
--- a/resources/js/components/video/VideoLyrics.vue
+++ b/resources/js/components/video/VideoLyrics.vue
@@ -110,7 +110,15 @@ const handleUpdate = () => {
const resetComponent = () => {
activeTime.value = 0;
+ if ($activeLyric.value && lyricObserver.value) {
+ lyricObserver.value.unobserve($activeLyric.value);
+ }
+
$activeLyric.value = null;
+ nextTick(() => {
+ lyricsContainer.value?.scrollTo({ top: 0, behavior: 'smooth' });
+ if (lyrics.value[0].percentage) activeTime.value = lyrics.value[0].percentage;
+ });
};
onMounted(() => {
@@ -128,6 +136,8 @@ onMounted(() => {
containerObserver.observe(lyricsContainer.value);
+ resetComponent();
+
lyricObserver.value = new IntersectionObserver(
([entry]) => {
isActiveLyricVisible.value = entry.isIntersecting;