Commit 435c86a2 authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Overlay lyrics on the album art, matching Spotify's actual placement

The previous pass put the live line as a small gray caption below the
cover art - still easy to miss, per the user's own Spotify screenshots.
Spotify's real placement overlays it directly on the art with a
gradient scrim, inside a scrollable card further down the page.

Adapted rather than copied, since this player is a fixed panel that
doesn't scroll: the live line (plus a one-line preview of what's next)
sits overlaid on the bottom of the art, reachable three ways now -
swipe up, tap the line, or an explicit chevron button - instead of one
easy-to-miss caption. The full lyrics screen's typography also moved
from centered/small to Spotify's actual large, bold, left-aligned
style. Verified against a real library song via Playwright.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent bba848ef
Pipeline #1164 passed with stage
in 5 minutes and 43 seconds
......@@ -101,7 +101,7 @@ describe('FullPlayer', () => {
expect(dialog().getByRole('button', { name: 'Open queue' })).toBeInTheDocument()
})
it('shows the live lyric line right under the cover art, with no tap needed to see it', async () => {
it('shows the live lyric line overlaid on the cover art, with no tap needed to see it', async () => {
vi.spyOn(streamApi, 'fetchStreamUrl').mockResolvedValue('blob:fake-url')
renderPlayer()
......@@ -135,6 +135,52 @@ describe('FullPlayer', () => {
expect(await screen.findByRole('button', { name: 'Lyrics: First' })).toBeInTheDocument()
})
it('previews the next synced line as a taste of what is coming, alongside the current one', async () => {
vi.spyOn(streamApi, 'fetchStreamUrl').mockResolvedValue('blob:fake-url')
vi.spyOn(libraryApi, 'getLyrics').mockResolvedValue({
status: 'success',
lyrics: 'First\nSecond',
synced_lyrics: [
[0, 'First'],
[10, 'Second'],
],
})
renderPlayer()
await userEvent.click(screen.getByText('Start Playback'))
await openFullPlayer()
await screen.findByRole('button', { name: 'Lyrics: First' })
// The full lyrics screen (off-screen but still mounted) has its own "Second" line too -
// scope to the overlay's own next-line preview specifically.
expect(screen.getByText('Second', { selector: '.line-clamp-1' })).toBeInTheDocument()
})
it('does not show a next-line preview for the plain-text fallback (no synced timing)', async () => {
vi.spyOn(streamApi, 'fetchStreamUrl').mockResolvedValue('blob:fake-url')
renderPlayer()
await userEvent.click(screen.getByText('Start Playback'))
await openFullPlayer()
await screen.findByRole('button', { name: 'Lyrics: Line one' })
// "Line two" is SONG_WITH_LYRICS's second plain line - showing it as a "next line" preview
// here would be presenting an arbitrary guess as if it were real synced timing.
expect(screen.queryByText('Line two')).not.toBeInTheDocument()
})
it('opens the full lyrics screen from the explicit chevron button too, not just the line itself', async () => {
vi.spyOn(streamApi, 'fetchStreamUrl').mockResolvedValue('blob:fake-url')
renderPlayer()
await userEvent.click(screen.getByText('Start Playback'))
await openFullPlayer()
await userEvent.click(screen.getByRole('button', { name: 'Show full lyrics' }))
expect(await screen.findByRole('region', { name: 'Lyrics' })).toBeInTheDocument()
})
it('opens the full lyrics screen from the live line, as a real deeper screen rather than an in-place crossfade', async () => {
vi.spyOn(streamApi, 'fetchStreamUrl').mockResolvedValue('blob:fake-url')
renderPlayer()
......
......@@ -3,11 +3,11 @@ import {
AudioLines,
ChevronDown,
ChevronLeft,
ChevronUp,
ListMusic,
Music2,
Pause,
Play,
Quote,
Repeat,
Repeat1,
ScrollText,
......@@ -205,12 +205,17 @@ export function FullPlayer() {
const pct = duration > 0 ? Math.min(100, (progress / duration) * 100) : 0
const RepeatIcon = repeatMode === 'one' ? Repeat1 : Repeat
// The live synced line (once one is active) is what makes this feel like Spotify's actual
// current pattern - a snippet that plays right under the cover with no tap needed. Before the
// first synced timestamp, or for a song with only plain (unsynced) lyrics, this falls back to
// the first non-empty plain line instead of showing nothing.
// current pattern - a snippet that plays with no tap needed, not a static first line behind a
// toggle. Before the first synced timestamp, or for a song with only plain (unsynced) lyrics,
// this falls back to the first non-empty plain line instead of showing nothing.
const liveLyricLine = syncedLyrics && activeLineIndex >= 0 ? syncedLyrics[activeLineIndex][1] : null
const lyricsPreview = currentSong.lyrics?.split('\n').find((line) => line.trim().length > 0)
const inlineLyricText = liveLyricLine ?? lyricsPreview ?? null
// A one-line taste of what's coming, the way Spotify's own lyrics card previews several lines
// at once rather than just the current one - only shown alongside a genuine live line (not the
// plain-text fallback above, where "next" isn't a meaningful concept for an arbitrary guess).
const nextLyricLine =
liveLyricLine && syncedLyrics && activeLineIndex + 1 < syncedLyrics.length ? syncedLyrics[activeLineIndex + 1][1] : null
return (
<div
......@@ -275,13 +280,20 @@ export function FullPlayer() {
</div>
<div className="relative mx-auto flex w-full max-w-md flex-1 flex-col px-8 py-4">
{/* Swipe up here to open the full lyrics screen (Spotify's actual gesture) - the
live line right below is the tap fallback, so the same action stays reachable
without a swipe for keyboard/screen-reader use. */}
{/* Lyrics live directly on the art, not as a caption floating below it - Spotify's own
placement, adapted rather than copied: theirs sits in a separate card further down
a page that can scroll past the transport controls; ours can't scroll, so instead
of a second screen area it's anchored right to the art it's already about, with a
gradient scrim for legibility over any image. A one-line taste of what's coming
(nextLyricLine) gives more context than a single line without needing that second
scrollable area. Reachable three ways once there's something to show: swipe up
anywhere on the art, tap the lyric text itself, or the explicit chevron - only the
first two exist purely as gestures with no visible affordance, which is exactly
what made the previous caption-below-the-art version easy to miss entirely. */}
<div
onPointerDown={inlineLyricText ? handleCoverPointerDown : undefined}
onPointerUp={inlineLyricText ? handleCoverPointerUp : undefined}
className="flex flex-1 items-center justify-center"
className="relative flex flex-1 items-center justify-center"
>
{currentSong.coverart ? (
<img
......@@ -300,29 +312,33 @@ export function FullPlayer() {
<Music2 size={64} strokeWidth={1.25} />
</div>
)}
</div>
{/* The live synced line, not a static "tap for lyrics" bar - this is what makes it
feel like part of the Now Playing screen rather than a separate lyrics feature.
Still a real button (not just a swipe target) so it's reachable without a
touchscreen. Only rendered once there's something to show, matching Spotify
(which hides this row entirely rather than linking to an empty screen). The Quote
icon exists purely so this reads as "lyrics" at a glance - plain centered gray
text on its own looked too much like an ordinary subtitle to register as an
interactive lyrics preview. */}
{inlineLyricText && (
<div className="absolute inset-x-0 bottom-0 max-w-sm overflow-hidden rounded-b-2xl">
<button
ref={lyricsLineButtonRef}
onClick={openLyrics}
tabIndex={queueOpen || lyricsOpen ? -1 : 0}
aria-label={`Lyrics: ${inlineLyricText}`}
className="mt-4 flex w-full items-center justify-center gap-1.5 rounded-lg px-2 py-1 text-sm text-on-surface-variant transition-colors hover:text-on-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
className="flex w-full flex-col items-start gap-0.5 bg-gradient-to-t from-black/85 via-black/55 to-transparent px-5 pb-4 pt-12 text-left focus-visible:outline-none"
>
<Quote size={13} strokeWidth={2} className="shrink-0 opacity-70" />
<span className="truncate">{inlineLyricText}</span>
<p className="line-clamp-2 text-lg font-bold leading-snug text-white [text-shadow:0_1px_4px_rgb(0_0_0_/_0.5)]">
{inlineLyricText}
</p>
{nextLyricLine && <p className="line-clamp-1 text-sm text-white/60">{nextLyricLine}</p>}
</button>
<button
onClick={openLyrics}
tabIndex={queueOpen || lyricsOpen ? -1 : 0}
aria-label="Show full lyrics"
className="absolute right-3 top-3 flex h-8 w-8 items-center justify-center rounded-full bg-black/40 text-white backdrop-blur-sm transition-colors hover:bg-black/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
>
<ChevronUp size={16} strokeWidth={2.5} />
</button>
</div>
)}
</div>
</div>
<div
className="relative mx-auto w-full max-w-md px-6 pb-6 sm:pb-8"
......@@ -467,8 +483,10 @@ export function FullPlayer() {
{syncedLyrics ? (
// Real line-by-line sync: past/future lines dim, the currently-playing one is
// full-brightness and bold, auto-scrolled to center (Spotify's actual signature
// lyrics behavior, not an approximation of it).
<div className="space-y-4 py-[40%]">
// lyrics behavior, not an approximation of it). Left-aligned and large, matching
// Spotify's own full-screen typography - the centered, smaller text this replaced
// read more like a generic text viewer than a karaoke-style lyrics screen.
<div className="space-y-5 py-[40%] text-left">
{syncedLyrics.map(([time, text], i) => {
const active = i === activeLineIndex
return (
......@@ -477,8 +495,8 @@ export function FullPlayer() {
ref={active ? activeLineRef : undefined}
onClick={() => seek(time)}
aria-current={active ? 'true' : undefined}
className={`cursor-pointer text-[19px] leading-snug transition-all duration-200 ${
active ? 'font-bold text-on-surface' : 'text-on-surface-variant/50 hover:text-on-surface-variant'
className={`cursor-pointer text-left text-2xl font-extrabold leading-tight transition-all duration-200 ${
active ? 'text-on-surface' : 'text-on-surface-variant/40 hover:text-on-surface-variant'
}`}
>
{text}
......
......@@ -189,7 +189,7 @@ const FRONTEND_DONE: DoneGroup[] = [
items: [
'Library page with playback',
'Real-time synced lyrics in the full-screen player (2026-08-31): line-by-line highlight follows playback position (last line whose timestamp has passed), auto-scrolls the active line to center, tapping a line seeks there - Spotify\'s actual signature lyrics behavior, not an approximation. Falls back to the existing static full-text view when a song has plain lyrics but no synced timing, and to the empty state when it has neither. Fixed same day: the synced-lyrics lookup was only attempted when the identification candidate itself had no plain lyrics already - but Shazam and Gemini can both independently return a plain snippet, which was silently skipping the sync fetch (and any real timing that existed) whenever that happened. Now always attempted, with synced data winning over the candidate\'s own plain text when found; existing library songs were backfilled',
'Lyrics presentation rebuilt to match Spotify\'s actual current pattern, not the "tap a bar to swap cover for lyrics" one from 08-31 (2026-09-01, researched via web search rather than guessed at): the live synced line now plays right under the cover art on the main Now Playing screen at all times - no tap needed to see it, matching what Spotify itself shipped as its headline update here. The full scrollable lyrics view is a step deeper, reached by swiping up on the cover (Spotify\'s real gesture) or tapping the live line (kept as a focusable fallback for keyboard/screen-reader use, since Spotify itself keeps a tappable entry point alongside the swipe) - a real slide-up screen with its own back control, closed by swipe-down, the back button, Escape, or system back, not the previous in-place crossfade toggle. Verified against 8 real library songs with a mix of synced/plain/no lyrics via Playwright and the line rendered correctly for all of them (only the one genuinely lyrics-less track showed nothing, as intended) - a follow-up report of "lyrics not shown" couldn\'t be reproduced, so a Quote icon was added next to the line as a same-day follow-up in case the real issue was the plain-text line not visually reading as an interactive lyrics preview.',
'Lyrics presentation rebuilt to match Spotify\'s actual current pattern, not the "tap a bar to swap cover for lyrics" one from 08-31 (2026-09-01, researched via web search rather than guessed at) - and then rebuilt again same day once the user shared real Spotify screenshots, since the first pass (live line as a small caption below the cover) still buried it. Spotify\'s own placement is a gradient-scrim overlay directly on the album art itself, inside a scrollable "Lyrics" preview card further down the Now Playing page; adapted rather than copied, since our player is a fixed panel that doesn\'t scroll: the live synced line (plus a one-line preview of what\'s coming next) sits overlaid on the bottom of the art with the same gradient-scrim treatment, with an explicit chevron button alongside the swipe-up gesture and the tap-the-line fallback - three independent ways to find the same action instead of one easy-to-miss caption. The full lyrics screen\'s typography also moved from centered/small to Spotify\'s actual large, bold, left-aligned style.',
'Universal search box: separate Songs and Albums result sections while searching - replaces the plain list rather than filtering it in place',
'Spotify-style default (non-search) view (2026-09-01): an Albums grid of cover-art cards above an always-on All Songs list covering the full library. The (album, artist) grouping is derived client-side from the already-loaded song list (mirroring /library/search\'s own grouping) rather than adding a second backend endpoint that would return the same shape - deletions and new songs update both sections for free since All Songs and the album groups both derive from the same one songs array.',
'Dedicated album page at /library/album (2026-09-01), replacing the earlier same-day expand-in-place version - tapping an album (from either the default grid or a search result row) now navigates to a real page showing its tracks in genuine track order, not upload/discovery order. This closed a real gap: identify_audio() (and the IdentifiedTrack cache) always computed a track_number, but LibrarySong had no column to store it in, so it was silently discarded on every tag/upload - added the column, a migration, persistence in _identify_tag_and_store, and a new GET /library/album?album=&artist= endpoint that sorts by it (numberless tracks sort after numbered ones, then alphabetically). Starting playback from any track in the list queues the rest of the real album order behind it, not just that one song. The page originally repeated the album name twice (Layout\'s own page-title heading, plus a second large one in the header) - caught by a genuinely flaky test rather than a design review, since jsdom happily renders two <h1>s with identical text where a real glance at the screenshot would\'ve caught it sooner; now only the one from Layout remains.',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment