# Sound issue on iOS

**URL:** <https://forum.playcanvas.com/t/sound-issue-on-ios/25194>\
**Category:** Help & Support\
**Tags:** sound, mobile\
**Created:** [April 13, 2022, 8:33am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194 "2022-04-13T08:33:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lorenzo](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lorenzo/32/20585_2.png) [@Lorenzo](https://forum.playcanvas.com/u/Lorenzo)\
**Post date:** [April 13, 2022, 8:33am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/1 "2022-04-13T08:33:57Z")

</div>

Hello all,

I am trying to play a sound after a prompt which asks the user a question. It should either play a correct sound or a buzzer sound.

It all works perfectly on android and PC but on iOS/Mac all sound disappears after the prompt appears.

Here is the simplified code that is causing the issue

```javascript
var soundEntity = this.app.root.findByName('soundEntity');
let answer = prompt('How much is 1 + 1?');
if (answer == 2) {
     soundEntity.sound.play('correct');
 } else {
     soundEntity.sound.play('wrong');
 }

```

Does anyone know why this could be and how to solve it?

Without the prompt pop-up it works fine.

I tried the following:

- Already playing the sound before the prompt on volume 0 so that it is already loaded
- Using setTimeout to play the sound later

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [April 13, 2022, 9:02am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/2 "2022-04-13T09:02:28Z")

</div>

Audio won’t play without a user interaction on the browser. Maybe that’s the issue here?

---

<div class="post-metadata">

**Author:** ![Lorenzo](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lorenzo/32/20585_2.png) [@Lorenzo](https://forum.playcanvas.com/u/Lorenzo)\
**Post date:** [April 13, 2022, 9:43am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/3 "2022-04-13T09:43:59Z")

</div>

Yeah indeed I probably have to look in that direction. It only works with user interaction AND it has to be synchronous. So the solution will probably be some kind of workaround.

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [April 13, 2022, 9:47am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/4 "2022-04-13T09:47:59Z")

</div>

I’ve not seen the application but if you have a title screen where the user presses a button to start the game, that would be enough to allow sound to be played through the whole session

Also, I would double check that the mute switch on the phone is not toggled. That has caught a number of devs out including me!

---

<div class="post-metadata">

**Author:** ![Lorenzo](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lorenzo/32/20585_2.png) [@Lorenzo](https://forum.playcanvas.com/u/Lorenzo)\
**Post date:** [April 13, 2022, 10:16am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/5 "2022-04-13T10:16:05Z")

</div>

> [@yaustar](#):
>
> Also, I would double check that the mute switch on the phone is not toggled. That has caught a number of devs out including me!

Thank you Yaustar, I appreciate. I don’t have a start button I will try some things and post the solution here if I find one.

---

<div class="post-metadata">

**Author:** ![MTHC\_Pulkit](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@MTHC\_Pulkit](https://forum.playcanvas.com/u/MTHC_Pulkit)\
**Post date:** [January 2, 2023, 10:00am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/6 "2023-01-02T10:00:17Z")

</div>

> [@yaustar](#):
>
> Also, I would double check that the mute switch on the phone is not toggled. That has caught a number of devs out including me!

@yaustar is there any way to check if the user’s device is switched to mute? I have checked with a website made with HTML and .js, its audio is playing fine on switching on mute, but cannot hear audio played from app made using sound component of PlayCanvas.

---

<div class="post-metadata">

**Author:** ![yaustar](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/yaustar/32/2268_2.png) [@yaustar](https://forum.playcanvas.com/u/yaustar)\
**Post date:** [January 2, 2023, 1:36pm UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/7 "2023-01-02T13:36:25Z")

</div>

As far as i know, there is not a way to know if the device is muted on iOS but there is a way to play PlayCanvas audio whike it is muted. See [IOS force play audio even with mute switch toggled · Issue #4678 · playcanvas/engine · GitHub](https://github.com/playcanvas/engine/issues/4678)

---

<div class="post-metadata">

**Author:** ![MTHC\_Pulkit](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/m/ad7895/32.png) [@MTHC\_Pulkit](https://forum.playcanvas.com/u/MTHC_Pulkit)\
**Post date:** [January 4, 2023, 6:31am UTC](https://forum.playcanvas.com/t/sound-issue-on-ios/25194/8 "2023-01-04T06:31:19Z")

</div>

Thank you for the solution
