From 68d570408335df1fddecbcf5cb4e558d436a540a Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Sun, 11 Jan 2026 01:10:04 -0600 Subject: [PATCH] fix: restore lyrics sync in ExpandedPlayer and improve performance - Add startActiveLineUpdates() trigger to ExpandedPlayer - Reduce transition times (200ms instead of 400ms) to fix lag - Simplify karaoke gradient for clearer visual effect --- src/lib/components/ExpandedPlayer.svelte | 8 ++++++++ src/lib/components/lyrics/LyricsLines.svelte | 21 ++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/lib/components/ExpandedPlayer.svelte b/src/lib/components/ExpandedPlayer.svelte index 5268000f5..3fd24c31a 100644 --- a/src/lib/components/ExpandedPlayer.svelte +++ b/src/lib/components/ExpandedPlayer.svelte @@ -2,6 +2,7 @@ import { X, Shuffle, SkipBack, Play, Pause, SkipForward, Repeat, Heart, List, Maximize2, MoreHorizontal, Cast } from 'lucide-svelte'; import QualityBadge from './QualityBadge.svelte'; import LyricsLines from './lyrics/LyricsLines.svelte'; + import { startActiveLineUpdates } from '$lib/stores/lyricsStore'; interface LyricsLine { text: string; @@ -90,6 +91,13 @@ const progress = $derived((currentTime / duration) * 100 || 0); const hasLyrics = $derived(lyricsLines.length > 0); + // Ensure lyrics updates run when ExpandedPlayer is open with synced lyrics + $effect(() => { + if (isOpen && isPlaying && lyricsSynced) { + startActiveLineUpdates(); + } + }); + function formatTime(seconds: number): string { if (!seconds || !isFinite(seconds)) return '0:00'; const mins = Math.floor(seconds / 60); diff --git a/src/lib/components/lyrics/LyricsLines.svelte b/src/lib/components/lyrics/LyricsLines.svelte index f7f1655e7..47300b112 100644 --- a/src/lib/components/lyrics/LyricsLines.svelte +++ b/src/lib/components/lyrics/LyricsLines.svelte @@ -215,11 +215,11 @@ letter-spacing: 0.01em; opacity: var(--line-opacity, 1); transition: - opacity 400ms cubic-bezier(0.4, 0, 0.2, 1), - transform 400ms cubic-bezier(0.4, 0, 0.2, 1), - font-size 300ms cubic-bezier(0.4, 0, 0.2, 1), - font-weight 300ms cubic-bezier(0.4, 0, 0.2, 1), - color 500ms cubic-bezier(0.4, 0, 0.2, 1); + opacity 200ms ease-out, + transform 200ms ease-out, + font-size 150ms ease-out, + font-weight 150ms ease-out, + color 250ms ease-out; transform-origin: left center; will-change: opacity, transform; } @@ -249,22 +249,17 @@ /* Shimmer karaoke effect on active line */ .lyrics-line.active .line-text { - --shimmer-width: 8%; --progress-pos: calc(var(--line-progress, 0) * 100%); background: linear-gradient( 90deg, - var(--accent-primary) 0%, - var(--accent-primary) calc(var(--progress-pos) - var(--shimmer-width)), - rgba(255, 255, 255, 0.95) calc(var(--progress-pos) - 2%), - rgba(255, 255, 255, 0.95) var(--progress-pos), - var(--text-primary) calc(var(--progress-pos) + 2%), + #a78bfa 0%, + #a78bfa var(--progress-pos), + var(--text-primary) var(--progress-pos), var(--text-primary) 100% ); - background-size: 100% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; - transition: background 50ms linear; } .lyrics-empty {