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

Hello everyone,

I write a PG here.
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)

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

iOS Audio | Babylon.js Playground (babylonjs.com)

2 Likes

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.

Besides, I cannot play this demo on Iphone Safari.

here is the PG: https://playground.babylonjs.com/#IDVX55#22

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 ), 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 ), 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.

As far as I know (and I know only little :wink: 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)?

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.

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