Skip to content

fix: unlock AudioContext on iOS for music playback (#2530)#2906

Open
sungdark wants to merge 5 commits intoFreezingMoon:masterfrom
sungdark:fix/no-music-iphone-2530
Open

fix: unlock AudioContext on iOS for music playback (#2530)#2906
sungdark wants to merge 5 commits intoFreezingMoon:masterfrom
sungdark:fix/no-music-iphone-2530

Conversation

@sungdark
Copy link
Copy Markdown

Description

iOS Safari and Chrome require a user gesture to resume the AudioContext, which starts in a suspended state. This fix adds event listeners that call context.resume() on first user interaction (click, touch, keydown), enabling music and sound effects to play on iOS devices.

Changes

  • Add unlockAudioOnIOS() method to SoundSys class
  • Call context.resume() on first user interaction
  • Remove listeners after successful unlock

Bounty

Fixes #2530 - no music on iPhone [bounty: 7 XTR]

bounty-scout and others added 5 commits March 26, 2026 23:21
Implement landscape orientation lock using the Screen Orientation API
when entering fullscreen mode on mobile devices. This addresses the
issue where users had to manually rotate their device, providing a
better mobile gaming experience.

The orientation is automatically locked to landscape when entering
fullscreen and unlocked when exiting.
 FreezingMoon#2174)

- Display cancel icon temporarily when clicking an active ability that is already used or unusable (require() returns false)
- Previously the cancel icon was only shown for passive ability cycling (Joywin case)
…n on projectile impact

- Move screen shake from ability activation to projectile onComplete callback
- Add hit sound (sounds/swing2) when projectile reaches target
- Fixes FreezingMoon#2234: Snow Bunny's Chilling Spit now triggers hit sound and
  screen shake only when projectile reaches the target, not before
- Add undoCreatureState and undoUsedThisRound to Game class
- Add saveUndoState() method to save creature state (position, remainingMove, health, energy)
- Add undoMove() method to restore creature to saved state
- Modify btnDelay click handler to trigger undo when undo state is available
- Add Ctrl+Z hotkey for undo
- Hook into move and ability use to save undo state on first action
- Reset undo state when new creature activates
- Undo is usable only once per round
iOS Safari and Chrome require a user gesture to resume the AudioContext,
which starts in a suspended state. This fix adds event listeners that
call context.resume() on first user interaction (click, touch, keydown),
enabling music and sound effects to play on iOS devices.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@sungdark is attempting to deploy a commit to the FreezingMoon Team on Vercel.

A member of the Team first needs to authorize it.

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.

no music on iPhone [bounty: 7 XTR]

1 participant