# Chrome only plays audio once there's mouse click

**URL:** <https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944>\
**Category:** Phaser 3\
**Created:** [July 13, 2021, 2:39pm UTC](https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944 "2021-07-13T14:39:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![esse\_senhor](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/esse_senhor/32/5387_2.png) [@esse\_senhor](https://phaser.discourse.group/u/esse_senhor)\
**Post date:** [July 13, 2021, 2:39pm UTC](https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944/1 "2021-07-13T14:39:51Z")

</div>

I have the following event listener in my scene’s _create_ method:

```javascript
    this.game.events.on('ADD_BODIES', (items) => {
      this.createBodies(items);
      this.sound.play('bubble-surfacing');
    }, this);

```

In Firefox this works perfectly fine and the sound is played, but on Chrome it only plays once I click the screen (anywhere). It seems like the sound.play method hangs in there waiting for user interaction, and only once that interaction happens does it play.

Any workaround?

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [July 13, 2021, 3:08pm UTC](https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944/2 "2021-07-13T15:08:27Z")

</div>

👋

Try to get a mouse click before then.

---

<div class="post-metadata">

**Author:** ![esse\_senhor](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/esse_senhor/32/5387_2.png) [@esse\_senhor](https://phaser.discourse.group/u/esse_senhor)\
**Post date:** [July 13, 2021, 3:11pm UTC](https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944/3 "2021-07-13T15:11:47Z")

</div>

Hey @samme thanks for replying.

I’ve checked and this seems to be a restriction with Chrome - sounds are only triggerable upon user gestures; even when the user has already clicked once on the window, if they then click on another window, the sound won’t play until he clicks again.

I guess doing what I’m trying to do would only be feasible by asking the user permission for notifications.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [July 13, 2021, 3:22pm UTC](https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944/4 "2021-07-13T15:22:41Z")

</div>

You can do something like

```javascript
if (this.sound.locked) {
  this.loadText.setText('Click to Start');

  this.input.once('pointerdown', () => {
    this.scene.start('MainMenu');
  });
}

```

---

<div class="post-metadata">

**Author:** ![somerandomdude](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/somerandomdude/32/3546_2.png) [@somerandomdude](https://phaser.discourse.group/u/somerandomdude)\
**Post date:** [July 14, 2021, 8:40pm UTC](https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944/5 "2021-07-14T20:40:39Z")

</div>

You could also check for an event, where as soon as the user hovers over the canvas, to enable sound

---

<div class="post-metadata">

**Author:** ![somerandomdude](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/somerandomdude/32/3546_2.png) [@somerandomdude](https://phaser.discourse.group/u/somerandomdude)\
**Post date:** [July 15, 2021, 2:02pm UTC](https://phaser.discourse.group/t/chrome-only-plays-audio-once-theres-mouse-click/9944/6 "2021-07-15T14:02:07Z")

</div>

Hey @esse_senhor , just checked a game I made, at [Breakout Breakdown](https://zainulabideenfazal.github.io/cs325-game-prototypes/Assignments/Digital%20Assignment%201/index.html), and it seems that I added  
audio: {  
disableWebAudio: true  
}

in the config. I’m not sure why (I did this a year ago, to be fair), but it doesn’t give me that warning in console about not allowing auto-play to happen. You could try forking my repo off my Github if you like and adding background sound as soon as the level loads to see if it works
