My oculus browser either crashes or doesn’t play sound at all when it has multiple audio files playing.
Definitely curious about this one @RaananW !
-Gabe
Hmmm… that can’t be good. I am checking, I hope there is something we can do about it.
Just checked in my device (oculus quest 1) - the playground opens and plays correctly. Anyone else can reproduce this? What quest do you use? 1 or 2?
I use quest 2
Hmm that’s weird, either the audio doesn’t play for me or it just crashes and I don’t get any console error
if anyone else experiencing this - i would be happy to know.
@PirateJC - i know you have a quest 2, would you be able to test the scene and share your experience?
Weird. I can confirm on Quest 2 that there is no audio that plays.
Here’s my experience:
- Load the playground
- I’m presented with the “enter VR” button
- I am NOT presented with any enable audio button.
- I do NOT hear any audio playing at all.
Note that when I open that playground on Desktop I DO see the enable audio button. I do not see it on the quest 2
I hope that’s helpful in some way @RaananW?
Ditto, same as the other JCP, except as I enter VR, I see that enable button flash. When I leave VR via the Oculus button, it is there, but the sound has probably already played (I never ran elsewhere, so just guessing).
@RaananW @PirateJC let me provide an additional example. I have an audio file crashes the Oculus Browser on Quest 2 (hard tab reset) every time it is loaded in BabylonJS, but the same file plays fine in Mozilla Hubs. Notable properties are that it is encoded with variable bit rate and is over 10 MB.
Playground: https://www.babylonjs-playground.com/#94QH6P#7
Repro: visit link and wait a minute for the sound to load in. The tab will crash and refresh
Hubs link: Virtual Seashell Celebration | Virtual Reign
Repro: visit link. Audio plays
Reproducible on my quest! interesting. I’ll play around with this, see what the issue might be.
Manage to find any clues on this strange one @RaananW ?
Yep!
Oculus browser’s AudioContext implementation has an issue with long sound files. Here is the demo without babylon involved:
sound test | Babylon.js Playground (babylonjs-playground.com)
When I use this my CPU is stuck at 100% for a few seconds, until the browser window is restarted.
Reading the documentation from audio context - AudioBuffer - Web APIs | MDN
The
AudioBuffer
interface represents a short audio asset residing in memory
So it feels like this file might simply be too long for the quest to deal with. Memory-wise it consumes too much.
The way hubs is using it is probably an audio element - sound test | Babylon.js Playground (babylonjs-playground.com)
This will work in any modern browser. But this won’t support spatial audio, which is one of the advantages of the sound class.
For babylon 6.0 we will probably put our focus on the audio engine (among other things). This is not yet set, but the audio implementation is relatively outdated and needs to be revamped.
Until then I would recommend not to use the sound class on long audio files, and use the Audio HTML element to play background music.