# How to add BABYLON.Sound when the video is playing?

**URL:** <https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190>\
**Category:** Questions\
**Tags:** tutorial\
**Created:** [May 9, 2022, 12:20pm UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190 "2022-05-09T12:20:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsAndy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wsandy/32/16904_2.png) [@wsAndy](https://forum.babylonjs.com/u/wsAndy)\
**Post date:** [May 9, 2022, 12:20pm UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190/1 "2022-05-09T12:20:30Z")

</div>

Hello everyone,

I write a PG [here](https://playground.babylonjs.com/#IDVX55#18).  
when I click the box, the video will play and a new Sound will link to this video and an Analyser will be created also. However, I cannot hear any sound and the analyser seems not has any input.( totally black)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 9, 2022, 1:18pm UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190/2 "2022-05-09T13:18:01Z")

</div>

You will need to make sure the audio file is playing:

[iOS Audio | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#IDVX55#19)

---

<div class="post-metadata">

**Author:** ![wsAndy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wsandy/32/16904_2.png) [@wsAndy](https://forum.babylonjs.com/u/wsAndy)\
**Post date:** [May 10, 2022, 3:09am UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190/3 "2022-05-10T03:09:36Z")

</div>

thanks!

Here is another problem. When I download this project and run this code in local, there is no any sound and some error occurs.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/7/072364dcd2ab6b34cdf5fc5145b6dcd0be183837.png)

Besides, I cannot play this demo on Iphone Safari.

here is the PG: [https://playground.babylonjs.com/#IDVX55#22](https://playground.babylonjs.com/#IDVX55#22)

---

<div class="post-metadata">

**Author:** ![wsAndy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wsandy/32/16904_2.png) [@wsAndy](https://forum.babylonjs.com/u/wsAndy)\
**Post date:** [May 10, 2022, 5:01am UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190/6 "2022-05-10T05:01:07Z")

</div>

I tried a lot and find that if I want to run PG in iphone, the BABYLON.Sound can only be initilized in click register.

Here is two PG, in the first one ( [https://playground.babylonjs.com/#IDVX55#24](https://playground.babylonjs.com/#IDVX55#24) ), the `window.addSound();` will run in 2seconds later. This PG could run in PC but failed in iphone.  
And the second one( [https://playground.babylonjs.com/#IDVX55#25](https://playground.babylonjs.com/#IDVX55#25) ), the `window.addSound(); ` is called in the click register function and this PG could work in both PC and iphone.

I don’t know the reason, in my option, it’s could a good idea if Sound can only be initialized in click register function.

Thanks anyway.

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [May 10, 2022, 8:35am UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190/7 "2022-05-10T08:35:28Z")

</div>

As far as I know (and I know only little 😉 this is a known iOS bug that was supposed to be fixed with the latest iOS update. May be @RaananW can confirm this (and tell you if there’s any chance it would be working from now on, or anytime soon)?

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 10, 2022, 9:46am UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190/8 "2022-05-10T09:46:24Z")

</div>

> [@wsAndy](#):
>
> When I download this project and run this code in local, there is no any sound and some error occurs.

As the error states, this call requires an interaction from the user (like a click). If I remember correctly the sound starts with a click on the canvas, so it should be working. It does seem like it’s not entirely a direct copy of the playground, because you seem to be using alpha.63, which is a relatively old version of the pre-released 5.X (which has nothing to do with the error, I am pretty sure, it’s just an observation).

About iOS - iOS has a few issues that we are “fighting” with. I would first try the latest 5.X release (at the moment 5.5.6) to see if we might have found a solution.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [June 8, 2022, 4:59pm UTC](https://forum.babylonjs.com/t/how-to-add-babylon-sound-when-the-video-is-playing/30190/9 "2022-06-08T16:59:25Z")

</div>

Hello @wsAndy just checking in, are you still having issues?
