Daily use 25: Audio attachments through the media player: any length, position, seek, rate (#513) #556

Closed
charles wants to merge 0 commits from dailyuse-25-audio-attachments into dailyuse
Owner

Stacked on: dailyuse-11a-core-dailyuse-ports

What

Audio attachments now play through the FFmpeg media player that video attachments already use (spec §17 Q5), in place of the 30 s / 20 MiB clip cache.

  • fluxer-core chat/media.rs: PlayAttachment sends Effect::Media(MediaCommand::Open { kind: Video, autoplay, start: 0, gain }) on proxy_url (else url). Playback streams by HTTP range with no length cap. Audio player ids start at PLAYER_BASE (2^62), well clear of the video player ids. CoreEvent::Media reports the length (before that, the server's duration is used) and the position.
  • Only one attachment plays at a time. The player closes (MediaCommand::Close) on: playing another attachment, StopAttachment (#352: the player is released, the old code only set its gain to 0), its end, a failure, deletion of its message or channel, and logout.
  • SeekAttachment { fraction } is clamped to 0..1, and a NaN fraction is ignored.
  • CycleAttachmentRate steps through AUDIO_PLAYBACK_RATES [1, 1.5, 2, 0.75] (MediaConstants.ts:3). For a voice message it uses VOICE_PLAYBACK_RATES [0.75, 1, 1.5, 2] (VoiceMessagePlayer.tsx:38). A voice message is detected with is_voice_message, which follows isVoiceMessageAttachment in Attachment.tsx:69. A rate chosen before playing is sent right after the Open.
  • Volume and mute are shared with the video players (MediaVolume, saved under [media]); changing them sends SetGain.
  • New selector: selectors::audio_player(&App, message_id, attachment_id) -> AudioPlayerModel { playing, position, duration, rate, volume, muted }. PlaybackModel / media_playback are kept for the current UI card, and position_ms is now real.
  • chat/video.rs: the audio attachment's player counts against MAX_VIDEO_PLAYERS, so the playback runtime never opens more than 8 players (the 9th would fail with "too many players"). chat/mod.rs now runs the video reducer before the media reducer, so the audio player reads the new volume and can make room among the videos.
  • apps/fluxer: no code change was needed. media_rt already opens a sound-only Video player. Only its docs and the README changed. fluxer-media-playback/src/player.rs is untouched: audio-only streams with an AudioOut already work. The soundboard keeps the clip cache.

Tests

  • crates/fluxer-core/tests/chat_audio_player.rs:
    • play_long_audio_opens_player_not_clip
    • seek_and_position_reported
    • rate_cycle_audio_and_voice
    • stop_releases_player
    • one_player_at_a_time
    • audio_player_counts_against_the_video_limit
  • apps/fluxer/tests/audio_attachment.rs three_minute_ogg_plays_past_30s: the devserver textchat scenario serves fixtures/media/three_minutes.ogg (3 min, 440 Hz Opus, 129 KB, made by tools/ffmpeg/make-fixtures.sh). The test uses an unpaced NullHost, advances virtual time past 35 s and checks that the output is not silent. It then seeks to 90 %, checks the tone again, stops, and checks that the mixer goes silent. No fake sink was needed: the media player's sound reaches the NullHost output.
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. On the base, before my changes, the two xtask package tests once failed with "Text file busy" (both extract appimagetool at the same time). They pass when re-run serially.
  • No FLUXER_DESKTOP_TESTS tests apply to this task.

Deviations / outside the Files list

  • crates/fluxer-core/src/app.rs (one line: close the audio player on logout), chat/mod.rs (reducer order and the &mut VideoPlayers argument), selectors/mod.rs (export), voice/soundboard.rs (a doc comment that named the removed TAG_BASE).
  • crates/fluxer-devserver/src/{chat.rs,http.rs} + README: an audio attachment whose name matches an audio file in fixtures/media is served from that file. This was needed for the 3-minute test; other audio still gets the one-second WAV tone.
  • crates/fluxer-core/tests/chat_media.rs: removed the old clip-path test (play_attachment_one_at_a_time); chat_audio_player.rs replaces it. crates/fluxer-ui/tests/attachments.rs: removed the injected clip ApiResult::Media, because the card now shows "playing" as soon as the player is opening.
  • Not done:
    • Seeking an attachment that is not playing does nothing (the original can set currentTime before play).
    • Audio keeps playing when you switch channels, as before. Videos close in that case.
  • widgets/message_content/audio.rs's doc comment still describes the clip path. That file belongs to Task 37a, which draws the seek bar and rate button.

Closes #364
Closes #352
Refs #378

Closes #513

🤖 Generated with Claude Code

Stacked on: dailyuse-11a-core-dailyuse-ports ## What Audio attachments now play through the FFmpeg media player that video attachments already use (spec §17 Q5), in place of the 30 s / 20 MiB clip cache. - `fluxer-core` `chat/media.rs`: `PlayAttachment` sends `Effect::Media(MediaCommand::Open { kind: Video, autoplay, start: 0, gain })` on `proxy_url` (else `url`). Playback streams by HTTP range with no length cap. Audio player ids start at `PLAYER_BASE` (2^62), well clear of the video player ids. `CoreEvent::Media` reports the length (before that, the server's `duration` is used) and the position. - Only one attachment plays at a time. The player closes (`MediaCommand::Close`) on: playing another attachment, `StopAttachment` (#352: the player is released, the old code only set its gain to 0), its end, a failure, deletion of its message or channel, and logout. - `SeekAttachment { fraction }` is clamped to 0..1, and a NaN fraction is ignored. - `CycleAttachmentRate` steps through `AUDIO_PLAYBACK_RATES` `[1, 1.5, 2, 0.75]` (`MediaConstants.ts:3`). For a voice message it uses `VOICE_PLAYBACK_RATES` `[0.75, 1, 1.5, 2]` (`VoiceMessagePlayer.tsx:38`). A voice message is detected with `is_voice_message`, which follows `isVoiceMessageAttachment` in `Attachment.tsx:69`. A rate chosen before playing is sent right after the `Open`. - Volume and mute are shared with the video players (`MediaVolume`, saved under `[media]`); changing them sends `SetGain`. - New selector: `selectors::audio_player(&App, message_id, attachment_id) -> AudioPlayerModel { playing, position, duration, rate, volume, muted }`. `PlaybackModel` / `media_playback` are kept for the current UI card, and `position_ms` is now real. - `chat/video.rs`: the audio attachment's player counts against `MAX_VIDEO_PLAYERS`, so the playback runtime never opens more than 8 players (the 9th would fail with "too many players"). `chat/mod.rs` now runs the video reducer before the media reducer, so the audio player reads the new volume and can make room among the videos. - `apps/fluxer`: no code change was needed. `media_rt` already opens a sound-only `Video` player. Only its docs and the README changed. `fluxer-media-playback/src/player.rs` is untouched: audio-only streams with an `AudioOut` already work. The soundboard keeps the clip cache. ## Tests - `crates/fluxer-core/tests/chat_audio_player.rs`: - `play_long_audio_opens_player_not_clip` - `seek_and_position_reported` - `rate_cycle_audio_and_voice` - `stop_releases_player` - `one_player_at_a_time` - `audio_player_counts_against_the_video_limit` - `apps/fluxer/tests/audio_attachment.rs` `three_minute_ogg_plays_past_30s`: the devserver `textchat` scenario serves `fixtures/media/three_minutes.ogg` (3 min, 440 Hz Opus, 129 KB, made by `tools/ffmpeg/make-fixtures.sh`). The test uses an unpaced `NullHost`, advances virtual time past 35 s and checks that the output is not silent. It then seeks to 90 %, checks the tone again, stops, and checks that the mixer goes silent. No fake sink was needed: the media player's sound reaches the `NullHost` output. - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. On the base, before my changes, the two xtask `package` tests once failed with "Text file busy" (both extract appimagetool at the same time). They pass when re-run serially. - No `FLUXER_DESKTOP_TESTS` tests apply to this task. ## Deviations / outside the Files list - `crates/fluxer-core/src/app.rs` (one line: close the audio player on logout), `chat/mod.rs` (reducer order and the `&mut VideoPlayers` argument), `selectors/mod.rs` (export), `voice/soundboard.rs` (a doc comment that named the removed `TAG_BASE`). - `crates/fluxer-devserver/src/{chat.rs,http.rs}` + README: an audio attachment whose name matches an audio file in `fixtures/media` is served from that file. This was needed for the 3-minute test; other audio still gets the one-second WAV tone. - `crates/fluxer-core/tests/chat_media.rs`: removed the old clip-path test (`play_attachment_one_at_a_time`); `chat_audio_player.rs` replaces it. `crates/fluxer-ui/tests/attachments.rs`: removed the injected clip `ApiResult::Media`, because the card now shows "playing" as soon as the player is opening. - Not done: - Seeking an attachment that is not playing does nothing (the original can set `currentTime` before play). - Audio keeps playing when you switch channels, as before. Videos close in that case. - `widgets/message_content/audio.rs`'s doc comment still describes the clip path. That file belongs to Task 37a, which draws the seek bar and rate button. Closes #364 Closes #352 Refs #378 Closes #513 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every UserAction, CoreEvent, Effect, ApiRequest/ApiResult and chat::Confirm
variant of the Daily use plan (Task 11a), plus the menu types (menus::MenuModel,
MenuItem, MenuItemKind, MenuItemId, MenuModel::flatten). New actions and events
do nothing yet; the runtime answers each new request with 501 CLIENT_NOT_WIRED
and logs Effect::Window until Daily use 28. MessageUser and CloseDm take a
confirmed flag and act as before; Notification gains icon (always None).

Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Core table tests for the audio attachment player and an app test that plays a
three-minute Ogg Opus file (fixtures/media/three_minutes.ogg, a 440 Hz tone made
with ffmpeg) past 30 s of virtual time on the NullHost.

Refs #513

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PlayAttachment opens a media-playback player (range streaming, as videos)
instead of FetchMedia + PlayClip; AudioPlayerModel per attachment with position,
duration, rate and the shared media volume; SeekAttachment and
CycleAttachmentRate ([1, 1.5, 2, 0.75], voice messages [0.75, 1, 1.5, 2]);
StopAttachment closes the player (#352). The attachment's player counts against
MAX_VIDEO_PLAYERS. The devserver serves fixtures/media audio files for
attachments of that name.

Refs #513

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Independent review: Daily use 25 (audio attachments)

Scope: git diff 95b0926..origin/dailyuse-25-audio-attachments (e2f1620).

Tests (plan step 1): all six exist and assert the plan's values. play_long_audio_opens_player_not_clip, seek_and_position_reported, rate_cycle_audio_and_voice (asserts [1, 1.5, 2, 0.75] and [0.75, 1, 1.5, 2]), stop_releases_player (MediaCommand::Close, #352), one_player_at_a_time, plus audio_player_counts_against_the_video_limit. The app test three_minute_ogg_plays_past_30s runs on an unpaced NullHost. It plays past 35 s, checks the peak is at least 1000, seeks to 0.9 and lands past 160 s, then checks there is silence after Stop. No fake sink was needed, and player.rs is unchanged. This also covers the end-to-end test #364 asked for.

Interfaces: AudioPlayerModel { playing, position, duration, rate, volume, muted } and selectors::audio_player(app, message_id, attachment_id) are there. SeekAttachment { fraction } is handled, with NaN ignored and the value clamped to 0..1. CycleAttachmentRate and StopAttachment both work, and StopAttachment really closes the player. Volume and mute are the video players' MediaVolume, and the soundboard keeps the clip cache. The selector lives in chat/media.rs and is re-exported from selectors/mod.rs, so selectors/content.rs and audio_rt.rs are untouched. Both are harmless deviations from the Files list.

Invariants: fluxer-core gains only std::time/BTreeMap; it does no I/O and has no forbidden imports. File reads were added only in the devserver. The fixture three_minutes.ogg is generated by make-fixtures.sh (bitexact, encoder tag only), with no paths or tokens. No URL is logged. Seek and server duration are guarded (try_from_secs_f64, finite and > 0), so they cannot panic. Media events for audio player ids are ignored by the video reducer (unknown id). The audio player counts against MAX_VIDEO_PLAYERS through reserve_audio/set_audio_players.

Parity spot checks (fluxer-soundboard):

  • MediaConstants.ts:3 AUDIO_PLAYBACK_RATES = [1, 1.5, 2, 0.75]: matches.
  • VoiceMessagePlayer.tsx:38 VOICE_PLAYBACK_RATE_STEPS = [0.75, 1, 1.5, 2]: matches.
  • MediaPlaybackRate.tsx:60-62: indexOf + 1 mod len; an unknown rate (-1) goes to index 0. next_rate matches.
  • Attachment.tsx:225: proxy_url ?? url: matches.
  • Attachment.tsx:69 isVoiceMessageAttachment: matches, but see finding 1.

Findings

  1. minor: is_voice_message uses is_audio, which falls back to file extensions. The original requires content_type starting with audio/. A VOICE_MESSAGE attachment with a waveform but no content type would get the voice rates here and the audio rates in the original. This is a narrow edge case.
  2. minor: play() re-implements the "proxy_url else url" choice inline. chat/video.rs:437 already has a helper for that ("reuse before adding").
  3. minor (for Task 37a): SeekAttachment on an attachment that is not playing is ignored, and Stop drops the position, so playing again restarts at 0. The original's <audio> seeks while paused and resumes from where it was. This is acceptable for Task 25's interface, but 37a's ←/→ ±5 % and the progress bar will need it when idle. Worth a follow-up issue.
  4. minor: the widgets/message_content/audio.rs doc comment is stale (it still describes the clip path and no seek/rate). That file belongs to Task 37a, which should fix it.

CI: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed (exit 0; three_minute_ogg_plays_past_30s ... ok).

Verdict: APPROVED (no blocking findings, CI green).

## Independent review: Daily use 25 (audio attachments) Scope: `git diff 95b0926..origin/dailyuse-25-audio-attachments` (e2f1620). **Tests (plan step 1):** all six exist and assert the plan's values. `play_long_audio_opens_player_not_clip`, `seek_and_position_reported`, `rate_cycle_audio_and_voice` (asserts `[1, 1.5, 2, 0.75]` and `[0.75, 1, 1.5, 2]`), `stop_releases_player` (`MediaCommand::Close`, #352), `one_player_at_a_time`, plus `audio_player_counts_against_the_video_limit`. The app test `three_minute_ogg_plays_past_30s` runs on an unpaced `NullHost`. It plays past 35 s, checks the peak is at least 1000, seeks to 0.9 and lands past 160 s, then checks there is silence after Stop. No fake sink was needed, and `player.rs` is unchanged. This also covers the end-to-end test #364 asked for. **Interfaces:** `AudioPlayerModel { playing, position, duration, rate, volume, muted }` and `selectors::audio_player(app, message_id, attachment_id)` are there. `SeekAttachment { fraction }` is handled, with NaN ignored and the value clamped to 0..1. `CycleAttachmentRate` and `StopAttachment` both work, and `StopAttachment` really closes the player. Volume and mute are the video players' `MediaVolume`, and the soundboard keeps the clip cache. The selector lives in `chat/media.rs` and is re-exported from `selectors/mod.rs`, so `selectors/content.rs` and `audio_rt.rs` are untouched. Both are harmless deviations from the Files list. **Invariants:** fluxer-core gains only `std::time`/`BTreeMap`; it does no I/O and has no forbidden imports. File reads were added only in the devserver. The fixture `three_minutes.ogg` is generated by `make-fixtures.sh` (bitexact, encoder tag only), with no paths or tokens. No URL is logged. Seek and server `duration` are guarded (`try_from_secs_f64`, finite and > 0), so they cannot panic. Media events for audio player ids are ignored by the video reducer (unknown id). The audio player counts against `MAX_VIDEO_PLAYERS` through `reserve_audio`/`set_audio_players`. **Parity spot checks (fluxer-soundboard):** - `MediaConstants.ts:3` `AUDIO_PLAYBACK_RATES = [1, 1.5, 2, 0.75]`: matches. - `VoiceMessagePlayer.tsx:38` `VOICE_PLAYBACK_RATE_STEPS = [0.75, 1, 1.5, 2]`: matches. - `MediaPlaybackRate.tsx:60-62`: `indexOf` + 1 mod len; an unknown rate (-1) goes to index 0. `next_rate` matches. - `Attachment.tsx:225`: `proxy_url ?? url`: matches. - `Attachment.tsx:69` `isVoiceMessageAttachment`: matches, but see finding 1. **Findings** 1. *minor*: `is_voice_message` uses `is_audio`, which falls back to file extensions. The original requires `content_type` starting with `audio/`. A VOICE_MESSAGE attachment with a waveform but no content type would get the voice rates here and the audio rates in the original. This is a narrow edge case. 2. *minor*: `play()` re-implements the "proxy_url else url" choice inline. `chat/video.rs:437` already has a helper for that ("reuse before adding"). 3. *minor* (for Task 37a): `SeekAttachment` on an attachment that is not playing is ignored, and Stop drops the position, so playing again restarts at 0. The original's `<audio>` seeks while paused and resumes from where it was. This is acceptable for Task 25's interface, but 37a's ←/→ ±5 % and the progress bar will need it when idle. Worth a follow-up issue. 4. *minor*: the `widgets/message_content/audio.rs` doc comment is stale (it still describes the clip path and no seek/rate). That file belongs to Task 37a, which should fix it. **CI:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: **all steps passed** (exit 0; `three_minute_ogg_plays_past_30s ... ok`). **Verdict: APPROVED** (no blocking findings, CI green).
Author
Owner

Independent review: Daily use 25 (audio attachments)

Reviewed 95b0926..origin/dailyuse-25-audio-attachments (e2f1620).

Plan tests (1): all five core tests exist in crates/fluxer-core/tests/chat_audio_player.rs (play_long_audio_opens_player_not_clip, seek_and_position_reported, rate_cycle_audio_and_voice, stop_releases_player, one_player_at_a_time) plus audio_player_counts_against_the_video_limit. They assert the spec values: rates [1, 1.5, 2, 0.75] and voice [0.75, 1, 1.5, 2], Stop sends MediaCommand::Close (#352), and volume/mute shared with [media]. The app test three_minute_ogg_plays_past_30s advances the NullHost past 35 s, checks the output is not silent, then seeks and stops (silent after stop). No fake sink was needed.

Interfaces (2): AudioPlayerModel { playing, position, duration, rate, volume, muted }, selectors::audio_player, SeekAttachment { fraction }, CycleAttachmentRate and StopAttachment are all present as written. PlayAttachment now opens a media player instead of FetchMedia + PlayClip. The soundboard keeps the clip cache.

Invariants (3): fluxer-core still does no I/O and has no new deps. NaN or out-of-range seek fractions are ignored or clamped, and server duration is filtered for finite and > 0, so server data can't panic the client. Logout closes the player. The new fixture is a generated tone with no secrets or paths.

Parity (4), spot-checked in the fork:

  • MediaConstants.ts:3 AUDIO_PLAYBACK_RATES: matches.
  • VoiceMessagePlayer.tsx:38 VOICE_PLAYBACK_RATE_STEPS: matches.
  • MediaPlaybackRate.tsx:60: an unknown rate goes to index 0. Matches next_rate.
  • Attachment.tsx:69-70,202 voice-message detection and proxy_url ?? url: matches.

Findings

  • minor: Playback rate persistence differs from the original. useMediaPlayer.ts:16,74-86,125 stores the rate per kind (audio / voice-message) in AppStorage (persistPlaybackRate defaults to true), so it applies to every audio file and survives restarts. Here it is kept per attachment, in memory only. The spec does not require persistence. Suggest a follow-up issue.
  • minor: There is no pause/resume. Toggling the playing attachment is a no-op, and Stop closes the player and loses the position. The original's inline player toggles pause. The interface does not name it.
  • minor: Seeking an attachment that is not playing is ignored. The original seeks the preloaded element. The implementer noted this.
  • minor: The plan lists selectors/content.rs and audio_rt.rs under Files, but neither was changed. That is fine because nothing needed them; noted for the record.

Review Focus (5): no item belongs to this task.

Local CI (6): FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci was started in the review worktree but had not finished (still in the clippy stage) when this review had to conclude. I cannot confirm a green run.

Verdict: not approved yet. There are no blocking code findings, but the reviewer's local CI run did not complete. Re-run FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci before labelling ready-to-merge.

## Independent review: Daily use 25 (audio attachments) Reviewed `95b0926..origin/dailyuse-25-audio-attachments` (e2f1620). **Plan tests (1):** all five core tests exist in `crates/fluxer-core/tests/chat_audio_player.rs` (`play_long_audio_opens_player_not_clip`, `seek_and_position_reported`, `rate_cycle_audio_and_voice`, `stop_releases_player`, `one_player_at_a_time`) plus `audio_player_counts_against_the_video_limit`. They assert the spec values: rates `[1, 1.5, 2, 0.75]` and voice `[0.75, 1, 1.5, 2]`, Stop sends `MediaCommand::Close` (#352), and volume/mute shared with `[media]`. The app test `three_minute_ogg_plays_past_30s` advances the `NullHost` past 35 s, checks the output is not silent, then seeks and stops (silent after stop). No fake sink was needed. **Interfaces (2):** `AudioPlayerModel { playing, position, duration, rate, volume, muted }`, `selectors::audio_player`, `SeekAttachment { fraction }`, `CycleAttachmentRate` and `StopAttachment` are all present as written. `PlayAttachment` now opens a media player instead of `FetchMedia` + `PlayClip`. The soundboard keeps the clip cache. **Invariants (3):** fluxer-core still does no I/O and has no new deps. NaN or out-of-range seek fractions are ignored or clamped, and server `duration` is filtered for finite and > 0, so server data can't panic the client. Logout closes the player. The new fixture is a generated tone with no secrets or paths. **Parity (4), spot-checked in the fork:** - `MediaConstants.ts:3` AUDIO_PLAYBACK_RATES: matches. - `VoiceMessagePlayer.tsx:38` VOICE_PLAYBACK_RATE_STEPS: matches. - `MediaPlaybackRate.tsx:60`: an unknown rate goes to index 0. Matches `next_rate`. - `Attachment.tsx:69-70,202` voice-message detection and `proxy_url ?? url`: matches. ### Findings - **minor:** Playback rate persistence differs from the original. `useMediaPlayer.ts:16,74-86,125` stores the rate **per kind** (`audio` / `voice-message`) in AppStorage (`persistPlaybackRate` defaults to true), so it applies to every audio file and survives restarts. Here it is kept per attachment, in memory only. The spec does not require persistence. Suggest a follow-up issue. - **minor:** There is no pause/resume. Toggling the playing attachment is a no-op, and Stop closes the player and loses the position. The original's inline player toggles pause. The interface does not name it. - **minor:** Seeking an attachment that is not playing is ignored. The original seeks the preloaded element. The implementer noted this. - **minor:** The plan lists `selectors/content.rs` and `audio_rt.rs` under Files, but neither was changed. That is fine because nothing needed them; noted for the record. **Review Focus (5):** no item belongs to this task. **Local CI (6):** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` was started in the review worktree but had **not finished** (still in the clippy stage) when this review had to conclude. I cannot confirm a green run. **Verdict: not approved yet.** There are no blocking code findings, but the reviewer's local CI run did not complete. Re-run `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` before labelling `ready-to-merge`.
Author
Owner

Review round 1, what changed per finding (no code change in this round; all findings are minor and none is a behaviour bug against the spec):

  1. Playback rate per attachment, in memory only (media.rs): deferred to follow-up #575 (one rate per kind, saved across restarts, with a parity entry).
  2. No pause/resume (media.rs): deferred to follow-up #576. It needs a paused state in fluxer-core and a play/pause button in fluxer-ui, so it is its own task.
  3. Seeking an attachment that is not playing is ignored (media.rs): deferred to follow-up #577 (pending start position passed as start to MediaCommand::Open).
  4. selectors/content.rs and audio_rt.rs listed in the plan but unchanged (audio_rt.rs): no change needed. Playback goes through the existing media player runtime and the selectors live in chat::media (audio_player, media_playback), so neither file had anything to do.

🤖 Generated with Claude Code

Review round 1, what changed per finding (no code change in this round; all findings are minor and none is a behaviour bug against the spec): 1. Playback rate per attachment, in memory only (media.rs): deferred to follow-up #575 (one rate per kind, saved across restarts, with a parity entry). 2. No pause/resume (media.rs): deferred to follow-up #576. It needs a paused state in fluxer-core and a play/pause button in fluxer-ui, so it is its own task. 3. Seeking an attachment that is not playing is ignored (media.rs): deferred to follow-up #577 (pending start position passed as `start` to `MediaCommand::Open`). 4. selectors/content.rs and audio_rt.rs listed in the plan but unchanged (audio_rt.rs): no change needed. Playback goes through the existing media player runtime and the selectors live in `chat::media` (`audio_player`, `media_playback`), so neither file had anything to do. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Independent review: Daily use 25 (audio attachments), head e2f1620

Scope: git diff 95b0926..origin/dailyuse-25-audio-attachments, read cold.

Checks

  1. Plan tests: all present. play_long_audio_opens_player_not_clip, seek_and_position_reported, rate_cycle_audio_and_voice, stop_releases_player and one_player_at_a_time are in crates/fluxer-core/tests/chat_audio_player.rs. There is one extra test, audio_player_counts_against_the_video_limit. three_minute_ogg_plays_past_30s in apps/fluxer/tests/audio_attachment.rs advances the NullHost clock past 35 s and asserts a peak of at least 1000 from take_output. The media player's audio reaches the NullHost output, so no fake sink was needed. The rate lists are asserted with the spec's exact values.
  2. Interfaces: AudioPlayerModel { playing, position, duration, rate, volume, muted } and selectors::audio_player exist. PlayAttachment now sends MediaCommand::Open; it no longer sends FetchMedia or PlayClip. SeekAttachment { fraction } is clamped and ignores NaN. CycleAttachmentRate uses [1, 1.5, 2, 0.75] (voice messages [0.75, 1, 1.5, 2]). StopAttachment sends MediaCommand::Close (#352). Volume and mute come from the shared MediaVolume ([media]). The soundboard clip path is untouched.
  3. Invariants: the core adds no I/O and no forbidden crates. Server data cannot panic the client: duration goes through try_from_secs_f64 and the finite/positive filter, the fraction is clamped, and next_rate indexes only non-empty constants. The fixture three_minutes.ogg comes from the ffmpeg script with bitexact flags and contains no paths or metadata. No URLs are logged. Logout resets chat.media through clear_account and closes the player.
  4. Parity, checked against the fork:
    • AUDIO_PLAYBACK_RATES matches MediaConstants.ts:3.
    • VOICE_PLAYBACK_RATE_STEPS matches VoiceMessagePlayer.tsx:38.
    • isVoiceMessageAttachment matches Attachment.tsx:69-70: the VOICE_MESSAGE flag (1<<13), audio, and a waveform.
    • The URL is proxy_url ?? url, as in Attachment.tsx:225.
    • An unknown rate goes to the first rate, as indexOf -1 → 0 does in MediaPlaybackRate.tsx.
    • The volume is shared with video, as useMediaVolume.ts stores it globally.
  5. Review Focus: no item applies to Task 25.
  6. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed (exit 0).

Findings

  • [minor] rate_cycle_audio_and_voice: from rate 1 the voice list and the audio list give the same sequence, because they are the same cycle rotated. The test therefore cannot tell which list a voice message uses. The only behaviour that differs is the fallback for an unknown rate (voice → 0.75, audio → 1), and it is untested. A test that starts from an off-list rate would cover it.
  • [minor] A seek before playing is ignored. The original sets currentTime instead. This is tracked in #577.
  • [minor] There is no pause: the card's pause button stops playback and resets the position to 0. The original pauses. This is tracked in #576.
  • [minor] The plan lists selectors/content.rs and audio_rt.rs under Modify, but neither changed. No change is needed there: playback goes through media_rt, and the selectors live in chat::media.

Verdict: approve. No blocking findings and local CI is green.

## Independent review: Daily use 25 (audio attachments), head e2f1620 Scope: `git diff 95b0926..origin/dailyuse-25-audio-attachments`, read cold. **Checks** 1. Plan tests: all present. `play_long_audio_opens_player_not_clip`, `seek_and_position_reported`, `rate_cycle_audio_and_voice`, `stop_releases_player` and `one_player_at_a_time` are in `crates/fluxer-core/tests/chat_audio_player.rs`. There is one extra test, `audio_player_counts_against_the_video_limit`. `three_minute_ogg_plays_past_30s` in `apps/fluxer/tests/audio_attachment.rs` advances the `NullHost` clock past 35 s and asserts a peak of at least 1000 from `take_output`. The media player's audio reaches the `NullHost` output, so no fake sink was needed. The rate lists are asserted with the spec's exact values. 2. Interfaces: `AudioPlayerModel { playing, position, duration, rate, volume, muted }` and `selectors::audio_player` exist. `PlayAttachment` now sends `MediaCommand::Open`; it no longer sends `FetchMedia` or `PlayClip`. `SeekAttachment { fraction }` is clamped and ignores NaN. `CycleAttachmentRate` uses `[1, 1.5, 2, 0.75]` (voice messages `[0.75, 1, 1.5, 2]`). `StopAttachment` sends `MediaCommand::Close` (#352). Volume and mute come from the shared `MediaVolume` (`[media]`). The soundboard clip path is untouched. 3. Invariants: the core adds no I/O and no forbidden crates. Server data cannot panic the client: `duration` goes through `try_from_secs_f64` and the finite/positive filter, the fraction is clamped, and `next_rate` indexes only non-empty constants. The fixture `three_minutes.ogg` comes from the ffmpeg script with bitexact flags and contains no paths or metadata. No URLs are logged. Logout resets `chat.media` through `clear_account` and closes the player. 4. Parity, checked against the fork: - `AUDIO_PLAYBACK_RATES` matches `MediaConstants.ts:3`. - `VOICE_PLAYBACK_RATE_STEPS` matches `VoiceMessagePlayer.tsx:38`. - `isVoiceMessageAttachment` matches `Attachment.tsx:69-70`: the `VOICE_MESSAGE` flag (1<<13), audio, and a waveform. - The URL is `proxy_url ?? url`, as in `Attachment.tsx:225`. - An unknown rate goes to the first rate, as `indexOf` -1 → 0 does in `MediaPlaybackRate.tsx`. - The volume is shared with video, as `useMediaVolume.ts` stores it globally. 5. Review Focus: no item applies to Task 25. 6. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: **all steps passed** (exit 0). **Findings** - [minor] `rate_cycle_audio_and_voice`: from rate 1 the voice list and the audio list give the same sequence, because they are the same cycle rotated. The test therefore cannot tell which list a voice message uses. The only behaviour that differs is the fallback for an unknown rate (voice → 0.75, audio → 1), and it is untested. A test that starts from an off-list rate would cover it. - [minor] A seek before playing is ignored. The original sets `currentTime` instead. This is tracked in #577. - [minor] There is no pause: the card's pause button stops playback and resets the position to 0. The original pauses. This is tracked in #576. - [minor] The plan lists `selectors/content.rs` and `audio_rt.rs` under Modify, but neither changed. No change is needed there: playback goes through `media_rt`, and the selectors live in `chat::media`. **Verdict: approve.** No blocking findings and local CI is green.
Author
Owner

Merged into dailyuse at f7972c3 (combined merge of 23 Daily use tasks plus textchat).

Merged into `dailyuse` at f7972c3 (combined merge of 23 Daily use tasks plus `textchat`).
charles closed this pull request 2026-11-15 06:08:57 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.