Skip to content

Shade the played span of the audio waveform as playback advances - #5826

Draft
lukemelia wants to merge 3 commits into
mainfrom
cs-12575-audio-waveform-reflects-playback-position-with
Draft

Shade the played span of the audio waveform as playback advances#5826
lukemelia wants to merge 3 commits into
mainfrom
cs-12575-audio-waveform-reflects-playback-position-with

Conversation

@lukemelia

Copy link
Copy Markdown
Contributor

In the reading formats (embedded/isolated), the default audio FileDef preview's waveform now reflects the native player's playback position, in the familiar audio-player idiom: the played portion renders in the full accent while the un-played remainder recedes to a dimmer shade, updating as the track plays and when the user seeks.

Waveform with played span highlighted

How it works

  • AudioPreview mirrors playback as a 0–1 ratio from the mounted <audio> element's timeupdate (plus seeking/emptied), preferring the element's own duration and falling back to the extracted duration before metadata arrives.
  • The played span is a second copy of the bars inside an SVG clipPath whose window width is the ratio, so partial-bar coverage is smooth rather than stepping bar-by-bar.
  • A track at rest keeps the waveform's usual full-strength look — the dimming class only applies once playback has begun.
  • Fitted cells mount no player, so their waveform is untouched.

Testing

  • New integration test in file-def-format-templates-test.gts: at rest nothing is marked played; after a timeupdate at 5s of a 10s track, the played layer exists and clips at half the waveform.
  • Full Integration | FileDef format templates module passes (17 tests, 61 assertions).
  • Verified live in the dev app against a 15-second PCM WAV.

Resolves CS-12575.

🤖 Generated with Claude Code

lukemelia and others added 3 commits August 19, 2026 18:41
In the reading formats, the waveform now mirrors the native player's
position: a clip-windowed copy of the bars tracks timeupdate from the
mounted audio element, so the played span keeps the accent at full
strength while the un-played remainder recedes. A track at rest keeps
the waveform's usual weight, and a fitted cell — which mounts no
player — is untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files      1 suites   1h 50m 51s ⏱️
4 310 tests 4 296 ✅ 14 💤 0 ❌
4 329 runs  4 315 ✅ 14 💤 0 ❌

Results for commit ae9ada3.

Realm Server Test Results

    1 files      1 suites   15m 30s ⏱️
2 190 tests 2 190 ✅ 0 💤 0 ❌
2 273 runs  2 273 ✅ 0 💤 0 ❌

Results for commit ae9ada3.

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.

1 participant