Spacilized 3D sound not working in GearVR in VR mode

Hi,

I Spatialized my sounds and in the PC browser and Chrome dev 83.0.4 in a Samsung note 8 Is working well in VRmode.

When I tried in my GearVR (sorry for now is the only one I have to test VR) in the VR mode is not reproducing, however out of the VR it is working the sound.

here an example in the PG: https://www.babylonjs-playground.com/#2AH4YH#19

cheers!

pinging @RaananW

Will check and let you know. I wonder how the gear browser handles sounds. Do you get the unmute button before entering VR?

I canā€™t seem to get sound working at all. Should it be playing before entering the scene?

Seems like it is not working when spatialSound is set to true. How can I reproduce a working example?

@RaananW yes, I did!

I also change between vr and nonVr and nonVR sound works.

I also did a test locally and a non specialized sound works perfectly during the vr mode.

1 Like

I used the example provided in the tutorial. It supposed to sound when you are inside the spheres. In VR mode to get inside the Spheres is hard, you have to get very close to the border and when the control is inside, move inside the sphere and you should start hearing the sound.

It is working, I tested from my PC and from the GearVR, the sound is only reproduce when you are inside the spheres, because it has a maxdistance equal to the spheres diameter. So in order to hear anything please get inside the sphere. As I explain before is a little bit tricky when you are in VRMode.

1 Like

Just tried with the gearvr - it works:

https://www.babylonjs-playground.com/#2AH4YH#21

you need to enter vr, exit when the sound starts, enable it in browser, and then enter again. but it works. teleport using your click input aiming at the floor (and not moving for 3 seconds)

Ok, so it only works if you are in webXR and not in WebVR. I still have problems making webXR work locally, while it works perfectly in the PB.

There is no WebVR for the gear VR. I canā€™t stress it more.
WebVR is non-existent.

The VR helper still tries thou, and this is why I recommend using the XR helper. Teleportation support is better, it is more future safe than a deprecated API, and is supported in more and more browsers.

If you place yourself inside the sphere, in any of the modes, you will hear the sound.

The reason I use the XR helper is that the gaze teleportation is the one thing I could create a fallback to from the VR helper to the XR helper.

I canā€™t remember if there was a real reason behind it, but - why not use XR, when the device you are using for development clearly supports only that?

Yep I tried and I undestand your point. As I told you before, locally it is not working when I use the polyfill. However in the playground it works fine my GearVR like in that Example you sent or some others I have done. I will try to work on the WebVR polyfill locally, to make you some questions about it and maybe we can figure it out?

And I will forever ask - why use the polyfill on a device that supports WebXR natively? And why not use the XR experience helper?

Iā€™m trying to understand what polyfill is required. WebVR is not available on the Gear VR browser.

You say it doesnā€™t work locally, are you serving the site over HTTPS? Want to share some code?

Hi @RaananW, Fist thanks for your time and help. Second, I laugh so much with your ā€œforever askā€.
Ok, so I tried back my XR code and remembering the reasons. 1) Iā€™m using the Oculus browser as the application to open my web XR/VR (Are you using a different one?). 2) Iā€™m serving my website using Python like this: python3 -m http.server 8087 and 3) Iā€™m using the code you provide in previous Questions that I also attached to this message.

source code

[https://dl.dropbox.com/s/k85tny1c1lbasdv/sampleXR.zip](http://source code)

You will find in the index.html at line 166 checking the XR support and a conditional that shows an alert if it is not supported which is what happened with my GearVR.

code extract
const xrSupport = await BABYLON.WebXRSessionManager.IsSessionSupportedAsync('immersive-vr');
            if (!xrSupport) {
                console.log('error, no XR support');
                alert("Xr not supported");
            } else {
                 const environment = scene.createDefaultEnvironment();
                // XR
                const xrHelper = await scene.createDefaultXRExperienceAsync({
                    floorMeshes: [ground]
                });
            }

I also I added the same line you added in the latest example you publish in this thread and the button to get in the XR experience does not appears, so you can not have any immersion experience? Again this is not happening in the playground, so I donā€™t know what it is going on. I previous threads I understood that the PB had the polyfill and thatā€™s why it was working.

1 Like

Herein lies the entire problem :slight_smile:

WebXR does not work when not used over HTTPS. it is simply not available. The python http server, thou nice and easy to use, does not support HTTPS (with or without a certificate).

I can only recommend trying a different dev server or doing this - simple-https-server.py Ā· GitHub

Bottom line - serve over https, XR will be available

3 Likes

Oh, and I was hoping you would :slight_smile: it wasnā€™t meant as anything else

holy moly finaly!!! so, after spending 1 hour checking the firewall of my PC because the !!!gear!vr connection was refused and looking for the open ports, I realize that what the simple-https-server.py Ā· GitHub was missing is that you have to change the ā€˜localhostā€™ in line 12 to ā€˜0.0.0.0ā€™ so you can accept external connections.

SO NOW Iā€™M FULL webXR thanks @RaananW!!!

2 Likes

awesome! glad it worked. Welcome to XR :slight_smile: