javascriptnetwork-programmingthree.jsaframeaframe-networked

Networked Aframe project not working with dynamic-rooms


I have a project I'm creating using A-frame (https://aframe.io) and the networked A-frame component: https://www.npmjs.com/package/networked-aframe

Link to the project: https://glitch.com/edit/#!/networkedtest

I've run into an issue where whenever I try to replace the following code in scene.html on line 202:

<a-scene moving-sun vr-mode-ui="enabled: false;" physics networked-scene="
      room: audio;
      adapter: easyrtc;
      audio: true;
      video: true;
      debug: true;
      inspector=https://cdn.jsdelivr.net/gh/aframevr/aframe-inspector@master/dist/aframe-inspector.min.js">
  

With this code:

<a-scene moving-sun vr-mode-ui="enabled: false;" physics dynamic-room="
      room: audio;
      adapter: easyrtc;
      audio: true;
      video: true;
      debug: true;
      inspector=https://cdn.jsdelivr.net/gh/aframevr/aframe-inspector@master/dist/aframe-inspector.min.js">

The entire code doesn't run properly and I get a blank white screen.

I'm not sure at all why this is, since all I'm doing is replacing the networked-scene="" line with dynamic-room="" but I still get a plane white screen. What I'm wondering is how inside the scene.html file on line 202, I can replace the first snippet of code with the second and have to code run properly.

If anybody knows why this issue is occurring, help would be very much appreciated.

Link to the project: https://glitch.com/edit/#!/networkedtest


Solution

  • Always check the console and try fixing any issue that you find there.

    One of them is:

    enter image description here

    From what I see, You do:

    var player = document.getElementById("player");
    var myNametag = player.querySelector(".nametag");
    myNametag.setAttribute("text", "value", username);
    

    In your scene.html, so there is no need to do the same in the dynamic-room component. Once you remove this bit from the dynamic-room it all works. So either remove it, or check why it's duplicated