Skip to content

Add album display option - #29

Closed
scruffian wants to merge 1 commit into
arraypress:mainfrom
scruffian:scruffian/show-album-name
Closed

Add album display option#29
scruffian wants to merge 1 commit into
arraypress:mainfrom
scruffian:scruffian/show-album-name

Conversation

@scruffian

Copy link
Copy Markdown
Contributor

Adds a showAlbum option and data-show-album attribute to render album names in the info block while preserving metadata-only default behavior. Wires album updates through loadTrack, external request event details, TypeScript declarations, README examples, CSS, and generated dist bundles. Adds coverage for data parsing, normalization, safe album rendering, request payloads, and track-swap album updates/removal. Verified with npm test and npm run build.

@scruffian

Copy link
Copy Markdown
Contributor Author

@arraypress what do you think?

@arraypress

Copy link
Copy Markdown
Owner

Thanks for this — it's a careful PR. syncAlbum mirrors syncArtist properly (including the anchor fallback), showAlbum is registered in BOOLEANS so it goes through the 1.25.0 normalization pass rather than around it, both render paths are escaped, and the committed dist/ reproduces byte-for-byte from npm run build. 245/245 green here too. Clearly written after reading the codebase, not at it.

I'm going to pass on it for core, though, and I want to give you the actual reasons rather than a vague "out of scope".

1. It breaks the size ceiling. I measured both branches, gzipped:

JS CSS
main 14,197 B 1,824 B
this PR 14,358 B 1,834 B

The documented ceiling is ~14KB (14,336 B). This lands 22 bytes over it and consumes all 139 B of remaining headroom to get there. That budget is real — the option-normalization pass in 1.25.0 cost +880 B and was a deliberate, measured trade for turning two hard crashes into warnings. A third metadata line isn't in that category.

2. One boolean here is fifteen packages of work. Types flow through the family via Omit<WaveformPlayerOptions>, but runtime doesn't — every wrapper forwards options through a hand-maintained allowlist. Adding a key makes it typecheck everywhere and work nowhere until each of the 4 player wrappers, the docs, and the site builder are edited by hand.

3. Two lines is the design, not an omission. album has existed in core since well before this — it feeds MediaMetadata for the lock screen (core.js:1007) and is deliberately not rendered. The info block is title + artist on purpose. The playlist went the same way, renaming showSubtitleshowArtist and data-subtitledata-artist to narrow a generic second line into one named field.

There's also a layout wrinkle: .waveform-layout-preview hides .waveform-meta entirely to stay compact for dense grids, and this would put a third line straight back in.

What I'd suggest instead

  • artist: "The Artist · The Album" works today, costs nothing, and is what the two-line design implies for most cases.
  • If it needs to be structural, waveform-playlist is the natural home — an album is a playlist. The hero layout has the vertical room, already has showArtist, and already receives album per-track. Happy to look at a PR there.

More useful to you than any of the above

I noticed Gutenberg carries patches/@arraypress+waveform-player+1.26.0.patch against src/, and both patches look upstreamable:

  • You strip data-play-icon / data-pause-icon from parseDataAttributes. Fair — that's raw SVG from a data attribute, and contributor-role authors shouldn't have that reach in a CMS. I'd take a flag or just remove the data-* path.
  • You hard-set autoInitDisabled = () => true rather than using the data-waveform-autoinit="false" opt-out from 1.26.0. That tells me the opt-out's shape is wrong for a bundled ESM consumer — there's no <html> attribute in scope when a block build's import evaluates. A dedicated @arraypress/waveform-player/no-autoinit entry point would fix that properly.

If you tell me what else is in that patch file, I'll upstream it and you can delete it. That's worth more to both of us than showAlbum.

And if the Playlist block genuinely needs album display, say so — that's a much stronger case than the diff alone makes, and it changes my answer.


Separately, and genuinely unrelated to any of the above — no urgency, and I'm only asking because you'd know who to point me at. The library isn't in the External Libraries list on the 7.1 credits page, though it's bundled in the Playlist block. Mediabunny, getID3 and MediaElement.js from that same stack are all listed. Is that just an oversight in the release process, or is there somewhere I should file it?

@scruffian

Copy link
Copy Markdown
Contributor Author

Separately, and genuinely unrelated to any of the above — no urgency, and I'm only asking because you'd know who to point me at. The library isn't in the External Libraries list on the 7.1 credits page, though it's bundled in the Playlist block. Mediabunny, getID3 and MediaElement.js from that same stack are all listed. Is that just an oversight in the release process, or is there somewhere I should file it?

Sorry about this, I had missed it. Where are you seeing those credits? I'll get it updated or find someone who can.

@scruffian

Copy link
Copy Markdown
Contributor Author

The need for an album setting came about from WordPress/gutenberg#81876, but you're right that we can just use the artist field for it and add the album name in (as that PR does). I wanted to run this idea past you first though, before we commit to using the artist field, so we are aligned on that approach - if you added an album field later then we'd want to change the approach which would create complications. Happy to stick with the approach as outlined above :)

@arraypress

Copy link
Copy Markdown
Owner

No apology needed — thanks for picking it up.

It's in the meta repo rather than core: WordPress/wordpress.orgapi.wordpress.org/public_html/core/credits/wp-71.php, in external_libraries() near the bottom. The list is alphabetical, so it'd slot between wasm-vips (L952) and whatwg-fetch (L953):

[ 'Waveform Player', 'https://waveformplayer.com' ],

Looks like a single missed line rather than anything systemic — Mediabunny went into that same list for the Playlist block work and this one just didn't follow behind it. wp-70.php has neither, so 7.1 is the only file that needs the entry; nothing to backfill.

That repo takes PRs directly, so it should be a quick one. Appreciate you sorting it.

@scruffian

Copy link
Copy Markdown
Contributor Author

In terms of the patch on 1.26.0, your analysis is correct, those are the two remaining concerns which we need to patch, there's nothing else in there. It would be great if we can remove that patch file!

@arraypress

Copy link
Copy Markdown
Owner

Really glad you asked before committing to it — that's exactly the right instinct, and it saves us both a migration later. So, to be unambiguous: no album field is coming to the player's info block. Build against artist and treat it as settled. I won't pull the rug on you.

The honest reason is less about bytes than my first reply made it sound. I'm a musician as well as the person maintaining this, and what I keep coming back to is that an album is a container, not a property of a track. Render it per-row and you end up printing the same string down the whole list.

It's worth looking at how the big services handle it. In an album view — Tidal, Spotify, Apple Music — there's no album column: just number, title, duration, because the album is the page you're already on. Album only earns a column in a mixed view, a playlist or search results or liked songs, where it's genuinely telling one row from another.

That's the distinction I'd bring to #81876. From the screenshot that tracklist looks like an album view, so "Show album name" would print the same value on every row for a line of vertical space per track. If a playlist really does mix releases then the column has a job — but even then the player doesn't need it, since it's showing one track at a time and the row it came from already said which release it's from.

So: artist field for the combined string, as your PR already does. Happy to be aligned on that :)

And on the patch — good news, that's a small enough surface. I'll get both into the next release: drop the data-play-icon / data-pause-icon parsing, and add a no-autoinit entry point so you're not monkey-patching autoInitDisabled. I'll ping you here when it's published so you can bin the file.

@scruffian

Copy link
Copy Markdown
Contributor Author

I get what you're saying about the album field (I'm a musician as well!). However I was thinking about a use case where someone might build a mixtape style playlist that contains multiple albums. We already have the album field so it seems strange that there's currently no option to display it. Feel free to comment on the Gutenberg PR, by the way, we're happy to get input from everyone :)

@scruffian

Copy link
Copy Markdown
Contributor Author

Closing this as it's served its purpose.

@scruffian scruffian closed this Aug 21, 2026
@scruffian

Copy link
Copy Markdown
Contributor Author

I added the credits here: WordPress/wordpress.org#825

@arraypress

Copy link
Copy Markdown
Owner

Perfect, thanks.

I gave you a shoutout here btw: https://docs.waveformplayer.com/news/wordpress-7-1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants