Skip to content

Adding audio - #62

Merged
Akshat-Raj merged 1 commit into
Genesis-ISE-DSCE:mainfrom
Akshat-Raj:launch
Apr 17, 2026
Merged

Adding audio#62
Akshat-Raj merged 1 commit into
Genesis-ISE-DSCE:mainfrom
Akshat-Raj:launch

Conversation

@Akshat-Raj

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings April 17, 2026 04:01
@vercel

vercel Bot commented Apr 17, 2026

Copy link
Copy Markdown

@Akshat-Raj is attempting to deploy a commit to the Genesis' projects Team on Vercel.

A member of the Team first needs to authorize it.

@Akshat-Raj
Akshat-Raj merged commit 4245ee4 into Genesis-ISE-DSCE:main Apr 17, 2026
3 of 4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds audio playback to the GenesisAnimation client-side launch sequence, starting on the user’s click and synchronizing a thunder SFX with the “charge up” phase.

Changes:

  • Add useRef-managed Audio instances for background music and thunder SFX.
  • Start background music on Pokéball click via a new handleStart handler.
  • Trigger thunder playback during Phase 2 and stop/reset all audio when the animation completes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

audioRef.current.volume = 0.5;
}
if (!thunderRef.current) {
thunderRef.current = new Audio("/audio/Thunder Sound Effects Loud and Scary_320k.mp3");

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thunder track path includes spaces ("/audio/Thunder Sound Effects..."). Spaces are not valid in a URL and rely on implicit encoding, which can lead to inconsistent requests/404s depending on the server/proxy. Consider renaming the file to a URL-safe name (kebab-case) and updating the path, or explicitly using an encoded URL.

Suggested change
thunderRef.current = new Audio("/audio/Thunder Sound Effects Loud and Scary_320k.mp3");
thunderRef.current = new Audio("/audio/Thunder%20Sound%20Effects%20Loud%20and%20Scary_320k.mp3");

Copilot uses AI. Check for mistakes.
Comment on lines +266 to +270
// Stop all music when animation is fully over
if (audioRef.current) {
audioRef.current.pause();
audioRef.current.currentTime = 0;
}

Copilot AI Apr 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audio is only paused/reset when the full animation completes. If the component unmounts (route change) or the async animation sequence throws/rejects partway through, the background/thunder audio can keep playing. Add a useEffect cleanup (return function) and/or wrap the run() body in try/finally so you always pause/reset audio and clear any pending timeouts when aborting.

Copilot uses AI. Check for mistakes.
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.

2 participants