[PR #844] [CLOSED] fix(client): restore HTMLAudioElement calls in combat voice playback #4803

Closed
opened 2026-10-22 04:10:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/844
Author: @Romuromylus
Created: 5/14/2026
Status: ❌ Closed

Base: main ← Head: fix/combat-voice-html-audio-element


📝 Commits (1)

  • 60b466b fix(client): restore HTMLAudioElement calls in combat voice playback

📊 Changes

1 file changed (+5 additions, -3 deletions)

View changed files

📝 packages/client/src/components/game/GameCombatUI.tsx (+5 -3)

📄 Description

Linked issue

Closes #842

Why this change

The client build is currently broken on main (fd768bfe). pnpm --filter @marinara-engine/client run build (and pnpm check) fails with:

src/components/game/GameCombatUI.tsx(732,35): error TS2339: Property 'stop' does not exist on type 'HTMLAudioElement'.
src/components/game/GameCombatUI.tsx(844,33): error TS2551: Property 'setVolume' does not exist on type 'HTMLAudioElement'. Did you mean 'volume'?
src/components/game/GameCombatUI.tsx(845,33): error TS2339: Property 'setMuted' does not exist on type 'HTMLAudioElement'.

In fd768bfe, three calls in GameCombatUI.tsx were rewritten as if combatVoiceAudioRef held one of the audio layer handles from packages/client/src/lib/game-audio.ts (the OneShotAudioLayer / LoopingAudioLayer interfaces, which DO expose stop / setVolume / setMuted). It doesn't — combatVoiceAudioRef is useRef<HTMLAudioElement | null>(null) (line 634), assigned via new Audio(url) (line 781). So the three calls don't compile.

This blocks anyone building from main, including any autoDeploy pipeline pointed at it. The tagged v1.5.9 release predates fd768bfe, so published artifacts aren't affected.

What changed

packages/client/src/components/game/GameCombatUI.tsx only. Restored the three call sites to the HTMLAudioElement surface that the rest of the same component already uses on this ref:

  • stopCombatVoicePlayback cleanup → pause() + clear onended / onerror (matches the pause/resume effect on line 821 already calling .pause() directly, and detaches the handlers assigned during playback).
  • Volume-update effect → audioManager.setMediaElementVolume(combatVoiceAudioRef.current, normalizedGameVoiceVolume) + audioManager is already in scope and used the same way on the creation path (line 783). The mute toggle is set with direct .muted = assignment, mirroring line 784 in the same file.

No other files touched; no behavior change beyond restoring the pre-fd768bfe semantics.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify combat voice playback in Game Mode: trigger a combat turn that produces voice lines, confirm audio plays.
  • Manually verify combat voice stop: cancel / switch turn mid-playback and confirm the audio stops cleanly with no error handler leftovers firing.
  • Manually verify the game voice volume slider takes effect on an in-progress combat voice line (the path this PR re-fixes).
  • Manually verify muting (slider at 0) silences in-progress combat voice without stopping playback.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No UI surface changed; this is a build-time TS regression fix.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced audio playback cleanup and volume handling in combat scenarios for improved stability.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/844 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 5/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/combat-voice-html-audio-element` --- ### 📝 Commits (1) - [`60b466b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/60b466b0bb485f6a372eea61634a74b4ec4f8de7) fix(client): restore HTMLAudioElement calls in combat voice playback ### 📊 Changes **1 file changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/game/GameCombatUI.tsx` (+5 -3) </details> ### 📄 Description ## Linked issue Closes #842 ## Why this change The client build is currently broken on `main` (`fd768bfe`). `pnpm --filter @marinara-engine/client run build` (and `pnpm check`) fails with: ``` src/components/game/GameCombatUI.tsx(732,35): error TS2339: Property 'stop' does not exist on type 'HTMLAudioElement'. src/components/game/GameCombatUI.tsx(844,33): error TS2551: Property 'setVolume' does not exist on type 'HTMLAudioElement'. Did you mean 'volume'? src/components/game/GameCombatUI.tsx(845,33): error TS2339: Property 'setMuted' does not exist on type 'HTMLAudioElement'. ``` In `fd768bfe`, three calls in `GameCombatUI.tsx` were rewritten as if `combatVoiceAudioRef` held one of the audio layer handles from `packages/client/src/lib/game-audio.ts` (the `OneShotAudioLayer` / `LoopingAudioLayer` interfaces, which DO expose `stop` / `setVolume` / `setMuted`). It doesn't — `combatVoiceAudioRef` is `useRef<HTMLAudioElement | null>(null)` (line 634), assigned via `new Audio(url)` (line 781). So the three calls don't compile. This blocks anyone building from `main`, including any autoDeploy pipeline pointed at it. The tagged `v1.5.9` release predates `fd768bfe`, so published artifacts aren't affected. ## What changed `packages/client/src/components/game/GameCombatUI.tsx` only. Restored the three call sites to the `HTMLAudioElement` surface that the rest of the same component already uses on this ref: - `stopCombatVoicePlayback` cleanup → `pause()` + clear `onended` / `onerror` (matches the pause/resume effect on line 821 already calling `.pause()` directly, and detaches the handlers assigned during playback). - Volume-update effect → `audioManager.setMediaElementVolume(combatVoiceAudioRef.current, normalizedGameVoiceVolume)` + `audioManager` is already in scope and used the same way on the creation path (line 783). The mute toggle is set with direct `.muted =` assignment, mirroring line 784 in the same file. No other files touched; no behavior change beyond restoring the pre-`fd768bfe` semantics. ## Validation - [ ] ``pnpm check`` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually verify combat voice playback in Game Mode: trigger a combat turn that produces voice lines, confirm audio plays. - Manually verify combat voice stop: cancel / switch turn mid-playback and confirm the audio stops cleanly with no error handler leftovers firing. - Manually verify the game voice volume slider takes effect on an in-progress combat voice line (the path this PR re-fixes). - Manually verify muting (slider at 0) silences in-progress combat voice without stopping playback. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No UI surface changed; this is a build-time TS regression fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Enhanced audio playback cleanup and volume handling in combat scenarios for improved stability. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/844) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:10:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4803
No description provided.