Video Thumbnail

Sign up for a plan to instantly unlock all premium lessons.

UNLOCK LESSON

Premium Features

Download Video

Mute Button

Keeping background music running in a game can get quite annoying. It makes sense to give users the option to turn this off. This tutorial will show you how to get free sound on / off icons to use and how to implement them so we can mute our game whenever we'd like.

HeroIcons: https://heroicons.com/

Comments

Want to participate?

Create a free Chris Courses account to begin

Login
d
dothacktriump posted 2 years ago

Hi Chris,

I been getting : "The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page."

along with: HTML5 Audio pool exhausted, returning potentially locked audio object.

I am running Howler version 2.2.4: https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.4/howler.min.js

0
kindahytz posted 3 years ago

Didn't work for me as it was. The music didn't come back after mute, but when i put the audio.background.play() method after the for loop in volumeOffEl click event listener it works

0

Providing the lift to launch your development career

© 2026 Chris Courses. All rights reserved.