Raitch Posted February 25, 2017 Share Posted February 25, 2017 TypeError: Failed to execute 'setPosition' on 'AudioListener': The provided float value is non-finite. at Scene._updateAudioParameters ( audioEngine.audioContext.listener.setPosition(listeningCamera.position.x, listeningCamera.position.y, listeningCamera.position.z); ) I'm getting an inconsistent error when trying to run a sound at the beginning of my game. I can't really find any ways to have the sound run when it's ready. Is this relevant to the camera or something? It solves itself if I just let it wait a couple of seconds, but that's not really ideal for me. I also use assetsManager to preload the sound and run the `new BABYLON.Sound` call. Cheers! Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted February 25, 2017 Share Posted February 25, 2017 if you just need sound playing with no 3d effects(position, direction, etc), you can simply use the html5 <audio> tag. <audio id="mySoundId" src="./assets/sounds/mySound.mp3" loop autoplay /> // loop parameter causes the audio to auto-replay. // autoplay parameter starts the audio file when it's loaded. //JS controls; mySoundId.play(); mySoundId.pause(); mySoundId.volume = x; Quote Link to comment Share on other sites More sharing options...
davrous Posted February 27, 2017 Share Posted February 27, 2017 Hello, I've explained in the documentation the various way to load a sound and handle the callback: http://doc.babylonjs.com/overviews/playing_sounds_and_music For instance, here is a playground shared in the doc using BABYLON.Sound and the AssetsManager: http://www.babylonjs-playground.com/#PCY1J#8 David 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.