I see an icon when a sound is created with babylon which is really very embarrassing. This covers my menu and I have to click on it at each scene load for the sound to play.
How to make it not show this icon loading the scene? Or can you click with code to close it?
I saw that Chrome had made some changes for that, and I noticed that if you click on the canvas before the scene is loaded, this icon does not show up.
So Iâm looking for ideas for the user to click on the canvas before loading the scenes so that it does not show up. Iâm looking for a useful idea and not just a button to say âload the sceneâ.
@wingnut The problem is that if this button is not click, the sound will not activate. So hide it, yes, but then, how to activate the sound?
In fact I noticed that this happens quad I did F5 to refresh the browser.If I me login index page and then am redirected to the game page, the button does not show and the sound activate. if I update the page of the game later (F5) the button appears and must be click to have the sound play.
If you want to go full custom: audioEngine.useCustomUnlockedButton = true; so nothing would show up but you ll need to call audioEngine.unlock(); yourself on the dom action you want.
I put âBABYLON.Engine.audioEngine.useCustomUnlockedButton = true;â after creating my photo Dom, and âBABYLON.Engine.audioEngine.unlock();â after creating my music. But I have a problem: The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
I donât understand, It worked one time then it didnât have worked anymore⊠I mean the sound is not working⊠The icon is still not displayed.
Do you know why ?
BTW, when I âconsole.log(BABYLON.Engine.AudioEngine.unlocked)â , it displays true, so the sounds should startâŠ
If you are using a custom unlock button, it means you are managing the entire UI on your own. Therefore you need to call unlock() only a user interaction like a click
else it will not be able to start.
Itâs restrictions by browsers, they usually are not give persmission to autoplay audio and video. User should interact with a page (make a click), after this page scripts can run audio play.
This starts from 2017, here is a proof Autoplay policy in Chrome - Chrome Developers
I know that BJS has a great Audio Engine but I fell more comfortable with Howler, also with a simple line of code you can do a fade in / out, change the pitchâŠ
It is still mandatory to press on the screen to activate the audio on mobile devices, but it is fixed with a home screen or a simple button
I think Howler does not give ability to use spatial sound of 3d scene.
And BabylonJS also has options to change volume with fade in / out. Itâs a second argument of setVolumeSound | Babylon.js Documentation
In fact, there are no easing, just linear change. Maybe it possible via gain property of the Sound instance, but I donât looked so deep.
But BabylonJS really does not have pitch. And it was a revelation for me - BabylonJS does not support AAC audio format. How?? Itâs 2023 already! xD