Mobile (iOS Safari): no audio at all — autoplay policy or webkit-specific issue #56
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
frankenbit/cellblock#56
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom (operator playtest, 2026-06-21, iPhone)
Operator: "No sound at all" — neither BGM nor SFX played on iPhone (Safari assumed). Desktop browsers work fine after PR #34 BGM gain fix; iOS audio entirely silent.
Likely root causes (need investigation)
iOS Safari has stricter Web Audio policy than desktop browsers:
AudioContext.resume()may need to be called inside the gesture handler synchronously. If our code creates the context outside the gesture and resumes it asynchronously, iOS Safari blocks audio.webkitAudioContextmay need different lifecycle handling than standardAudioContext. The unprefixed standard works in most modern Safari but some edge cases remain.Diagnostic suggestion
audioContext.resume()synchronouslyIf no Mac available for inspector: try adding a debug overlay that prints
audioContext.stateto the canvas after first tap, deploy, retest.Lane
Shipwright — audio.ts + mobile audio policy investigation.
Effort
Size/M — diagnostic + fix. Fix may be one line (sync
resume()in click handler) or more substantial (webkit-prefixed fallback paths).Note: BGM round-2 fix worked on desktop
PR #34 raised MUSIC_GAIN 0.035→0.12 (fixed inaudible-but-running). Operator confirmed BGM round-2 was audible on desktop. So the issue isn't the gain; it's iOS-specific audio-context-policy blocking everything at the substrate level.
Resolved by diagnostic instrument — root cause was operator-state (iPhone silent-mode physical switch), not a code bug. Operator confirmed via PR #58 debug-overlay iteration cycle: with silent mode OFF, audio works fine (and probably worked before PR #58 too — Shipwright already had synchronous AudioContext.resume() in the gesture handler from earlier work).
PR #58 (silent-buffer-kick + re-arm-on-iOS-suspend) ships net-positive defensive substrate-hardening regardless — handles real iOS-autoplay-policy edge cases (background/foreground cycles, context-creation-timing) that the original code might not have. Plus the ?debug=audio diagnostic overlay remains available for any future iOS audio issue (URL-gated, never affects normal users).
Bank-instance: the diagnostic instrument worked as designed — surfaced environment-vs-code distinction in a single device-iteration cycle. Without the overlay, the iteration loop might have spent multiple cycles assuming code conditions before reaching the silent-mode hypothesis. The instrument-merge-as-iteration-enablement pattern (Surveyor + Bosun banked earlier in this cycle) validated empirically.
Closing as resolved.