ozRocker Posted March 24, 2016 Share Posted March 24, 2016 I recently did some work for a mate using Babylon.js http://www.aarontyler.com.au/blog/strayashrapnel and its basically a Wordpress page which contains iFrames to my 3D pages, so basically there are multiple instances of Babylon.js being loaded. This worked fine on desktop but started breaking on mobile devices after about the 4th instance. The problem was having too many audio engines. I solved this by commenting out some code from the .js file I removed this: this._updateAudioParameters(); and this: if (this._audioEngine.canUseWebAudio) { this._outputAudioNode = this._audioEngine.audioContext.createGain(); this._outputAudioNode.connect(this._audioEngine.masterGain); if (options) { if (options.volume) { this._outputAudioNode.gain.value = options.volume; } if (options.mainTrack) { this._isMainTrack = options.mainTrack; } } } I'm wondering if there's a better way to do this. I couldn't see how it was possible to load Babylon.js and disable the audio engine because the file would stop parsing as soon as it caused an error. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted March 25, 2016 Share Posted March 25, 2016 Something worth trying is running Babylon core. Web audio is not included there. ozRocker 1 Quote Link to comment Share on other sites More sharing options...
ozRocker Posted March 26, 2016 Author Share Posted March 26, 2016 8 hours ago, JCPalmer said: Something worth trying is running Babylon core. Web audio is not included there. interesting...I just noticed that. Seems to be in the 2.3 version only http://doc.babylonjs.com/generals/Framework_versions So I guess I can include the core then include all the other extras that I might be using as well. Thanks for the heads up bro! Quote Link to comment Share on other sites More sharing options...
davrous Posted March 27, 2016 Share Posted March 27, 2016 Interesting. I'm normally creating the audio context only if you're requesting to play a sound via a BABYLON.Sound instancing. Otherwise, I'm never creating an audio context. As far as I remember, I've put that logic starting with v2.2. Which version did you use? Does the problem occur on iOS or Android (or both)? You can indeed use also the core version where we've simply removed the audio engine references & code. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted March 28, 2016 Author Share Posted March 28, 2016 16 hours ago, davrous said: Interesting. I'm normally creating the audio context only if you're requesting to play a sound via a BABYLON.Sound instancing. Otherwise, I'm never creating an audio context. As far as I remember, I've put that logic starting with v2.2. Which version did you use? Does the problem occur on iOS or Android (or both)? You can indeed use also the core version where we've simply removed the audio engine references & code. This was with Babylon 2.1. I was getting problems with iOS. Didn't test it properly with Android. It was spitting out errors on the console about too many audio engines. Was fine on the desktop browsers though. I switched to using the core now and its working sweet GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.