# Phaser 3 - How am I doing AudioContext stuff wrong?

**URL:** <https://phaser.discourse.group/t/phaser-3-how-am-i-doing-audiocontext-stuff-wrong/778>\
**Category:** Phaser 3\
**Created:** [January 16, 2019, 4:04am UTC](https://phaser.discourse.group/t/phaser-3-how-am-i-doing-audiocontext-stuff-wrong/778 "2019-01-16T04:04:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![masonsklar](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@masonsklar](https://phaser.discourse.group/u/masonsklar)\
**Post date:** [January 16, 2019, 4:04am UTC](https://phaser.discourse.group/t/phaser-3-how-am-i-doing-audiocontext-stuff-wrong/778/1 "2019-01-16T04:04:55Z")

</div>

Hi! I have this project I’ve been working on and I’m having a hard time getting it to work well with I’m pretty sure the Webkit autoplay policy stuff. It actually works for me fine in Chrome, but not Safari or iOS. Safari won’t even show some stuff in the console that Chrome will regarding the AudioContext. Can someone point me in the right direction? Thanks 🙂

[http://files.masonsklar.com/local/](http://files.masonsklar.com/local/)

---

<div class="post-metadata">

**Author:** ![Mikey](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/mikey/32/506_2.png) [@Mikey](https://phaser.discourse.group/u/Mikey)\
**Post date:** [January 17, 2019, 12:07pm UTC](https://phaser.discourse.group/t/phaser-3-how-am-i-doing-audiocontext-stuff-wrong/778/2 "2019-01-17T12:07:18Z")

</div>

Yeah I am having the same problem: the app I’m working on doesn’t want to play sound on iOS (I posted about this separately). Desktop Chrome will complain in the console, but eventually plays sound. The examples on the labs work fine, but copy-pasting that code directly doesn’t work - so it must be something else (in the HTML, presumably).

---

<div class="post-metadata">

**Author:** ![Mikey](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/mikey/32/506_2.png) [@Mikey](https://phaser.discourse.group/u/Mikey)\
**Post date:** [January 17, 2019, 1:09pm UTC](https://phaser.discourse.group/t/phaser-3-how-am-i-doing-audiocontext-stuff-wrong/778/3 "2019-01-17T13:09:57Z")

</div>

Possible answer (worked for me, can’t say whether it will for you):

```
			this.input.addDownCallback(function() {
				
				if (game.sound.context.state === 'suspended') {
					game.sound.context.resume();
				}
				
			});

```

Before y’all think I didn’t bother to read the documentation or even the warning given, I had that exact code bound to “pointerdown” and/or “pointerup” - but apparently that doesn’t cut it.

---

<div class="post-metadata">

**Author:** ![masonsklar](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@masonsklar](https://phaser.discourse.group/u/masonsklar)\
**Post date:** [January 18, 2019, 1:51am UTC](https://phaser.discourse.group/t/phaser-3-how-am-i-doing-audiocontext-stuff-wrong/778/4 "2019-01-18T01:51:48Z")

</div>

Thanks! I figured it out! I was having a hard time getting Safari to accept that a click in Phaser was a gesture worthy of resuming the AudioContext. I made sure that the AudioContext was created before my game and made it so that clicking on a div starts the game and resumes the AudioContext.
