Troubleshooting a connected A-frame problem involving dynamic room configurations and video streaming

I have been developing a project utilizing A-frame () along with the networked A-frame component (https://www.npmjs.com/package/networked-aframe)

(project located at: )

I have encountered an issue with the video feed in my project. Currently, the video feed functions properly; however, when I switch this line of 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">

Upon testing my code by opening two tabs, instead of the video feed, there is only a blank white plane displayed. It's puzzling because simply exchanging networked-scene="" with dynamic-room="" causes the video feed to stop functioning, showing a white screen on other tabs instead.

This unexpected behavior has left me perplexed as changing from networked-scene to dynamic-room should not result in such issues. Despite attempting various code modifications, the root cause of this problem eludes me. My suspicion is that the error lies within

public/js/dynamic-room.component.js
, although I could be mistaken.

If you possess any insights on how to resolve this dilemma, your assistance would be greatly appreciated.

Here is the link to my project:

Answer №1

Regarding the question posted here, here is a follow-up.

In your code, the dynamic-room component only sets the room id and emits a connect event for the networked-scene to connect to the server:

// public/js/dynamic-room.component.js

// Setup networked-scene
var networkedComp = {
  room: params.room
};
// set the room
el.setAttribute("networked-scene", networkedComp);    
// emit connect
el.emit("connect", null, false);

It's important to note that the dynamic-room complements the networked-scene, rather than being an alternative. If you disable auto-connect before loading the scene like this:

<script>
AFRAME.components["networked-scene"].schema.connectOnLoad.default = false;
</script>
<a-scene dynamic-room networked-scene>

The video should display correctly (you can see it working in this Glitch project)


If you prefer the dynamic-room component to handle all the setup that the networked-scene does, then Michael's answer is also valid.

Answer №2

You are definitely heading in the right direction.

It seems like you are interested in utilizing dynamic-room to fetch a custom room name from the URL. (This functionality is specifically designed for that purpose, so if it doesn't align with your needs, dynamic-room may not be suitable.)

In the example provided for dynamic room, the script scans the URL and automatically generates the "networked-scene" component, attaching it to your HTML tag.

This sample code was created prior to video support being integrated, hence why there's no validation for video: true:

var isMultiuser = params.hasOwnProperty('room');
var webrtc = params.hasOwnProperty('webrtc');
var adapter = webrtc ? 'easyrtc' : 'wseasyrtc';
var voice = params.hasOwnProperty('voice');

var networkedComp = {
    room: params.room,
    adapter: adapter,
    audio: voice //<--Only setting the audio property here
};
console.info('Initializing networked-aframe with these settings:', networkedComp);
el.setAttribute('networked-scene', networkedComp);

I suggest transferring your parameters to dynamic-room.component.js (located on line 18).

Only the room name will be fetched from the URL. (In case it's unspecified, it will default to 'audio,' similar to how the networked-scene parameter functions.)

var roomNameFromURL = params.hasOwnProperty('room');
//We won't check for these:
//var webrtc = params.hasOwnProperty('webrtc');
//var adapter = webrtc ? 'easyrtc' : 'wseasyrtc';
//var voice = params.hasOwnProperty('voice');

var networkedComp = {
    //if there is no name in the URL, default to 'audio',
    //  like your networked-scene
    room: roomNameFromURL ? params.room : 'audio',
    adapter: 'easyrtc',
    audio: true,
    video: true,
    debug: true
};
console.info('Initializing networked-aframe with these settings:', networkedComp);
el.setAttribute('networked-scene', networkedComp);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for parsing form values using jQuery AJAX:

Is there a way to extract form values and check if 15 objects have values or not? I attempted to do this using jQuery.parseJSON() but it didn't work as expected. [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Obj ...

Buttons in Laravel are shifting unexpectedly

There are three buttons available with different functions. <div class="form-group row mb-0"> <div class="col-md-6 offset-md-4"> <button type="submit" class="btn btn-primary"> {{ __('update') ...

Action of the Floater Button in Material UI

I'm currently working with Material UI's floater button component and I am having trouble getting it to open a menu onClick as intended. It is frustrating that there are no example codes available that demonstrate how to make the menu appear when ...

Restrict the height of posts created in the summernote editor

My goal is to create a structured page application using summernote. When using summernote, a div with contenteditable=true is appended to the body to allow users to add content. However, I want to set a fixed height for this div so that users can only ent ...

Explore Silverlights assortment using JavaScript

I have embedded a Silverlight class into my page, and in App.xaml.cs this component is registered to allow calls to Silverlight methods from JavaScript, which is functioning correctly. However, I now want to access not just methods, but collections. For e ...

What is the process for updating the list to retrieve fresh data from the service?

I am currently in the process of calling a web service to retrieve data and display it in a list using directives. Upon loading my fiddle, I successfully load data from a JSON file. The data is displayed correctly in the list. If I click the delete butto ...

I am encountering difficulty in printing multiple documents from FireStore

I am facing an issue where I can successfully retrieve and print all documents from a Firestore collection one by one using console.log(). However, when attempting to display these documents on the screen, only the most recent document is showing up. Here ...

Having trouble with the "foreach" binding in knockout where the "html" binding buttons are not functioning properly in Javascript

I'm experiencing an issue with the following code: <html lang="en"> <head> <link href="css/bootstrap.min.css" rel="stylesheet"> </head> <body> <script type='text/javascript' src='knockout-3. ...

Issue with PassportJS and Express 4 failing to properly store cookies/session data

I have a situation with my Express 4 app using Passport 0.3.2. I've set up a passport-local strategy, and it's successfully retrieving the user information when the /session endpoint is provided with a username and password. The issue arises whe ...

Managing date fields retrieved from a REST Api in AngularJS

One of the challenges I'm facing involves a REST API that sends back JSON data with dates formatted in ISO-8601 style: yyyy-MM-ddTHH:mm:ss: { id: 4 version: 3 code: "ADSFASDF" definition: "asdflkj" type: "CONTAINER" value: "12 ...

Issue with rendering components list in React.js

I am currently working on a project using React, and I'm facing an issue where my list is not displaying on render(). In my parent component, I have a list of components coming from SearchResult. Below is the relevant portion of my code: class Create ...

Manipulate a value using JavaScript

While the intention is for the button value to switch between 1 and 0, the echo $_POST["ordina"] consistently returns 1. Despite checking the code multiple times, I am unable to identify the issue. <script> function order() { if (document.ordination ...

Using SCSS to apply a class in Next.js

Currently, I am working on a project using Next.js and implementing the SCSS module procedure for styling. An example component directory structure is as follows: SampleComponent -> index.tsx and SampleComponent.module.scss The code in SampleComponent ...

Close button for body

I have created a form that floats in the center of the screen On this form, I have included a button designed to close it However, I would like for the form to be closed anywhere on the screen when clicked with the mouse Here is my code: $(".offer-clo ...

Enhancing Perspective Transformation in Three.js with Postprocessing

I am exploring the world of three.js and want to create a captivating scene where the camera is in motion. Each frame will showcase 4 points that together form a quadrilateral. My goal is to manipulate these 4 points in such a way that they align with the ...

Using Vuejs to iterate over nested data

I am looking to implement a nested v-for loop in Vuejs, but I am unsure about how to structure my Data and the v-for loop itself. My goal is to iterate through modifiers without having to specify modifiers1, modifiers2 individually. The idea is to have t ...

Using TypeScript to pass uniforms to a custom shader in React-Three-Fiber

As I make the switch to TypeScript, I'm encountering an issue with getting uniform values sent into a shader. Despite no errors and everything running smoothly, the uniform is not updating as expected or even being sent in the first place. This suspic ...

Implementing validation and displaying fields with v-model in vue.js

Looking at this code snippet: <button type="button @click="editing=true">Edit</button> <form v-show="editing" @submit="onSubmit"> <textarea v-model="text"></textarea> </form> <div> Current value: {{text}} </ ...

SystemJS could not locate the root directory for RxJS

There seems to be an issue with SystemJS loading rxjs modules on Windows, as it throws a 404 Not Found error on the rxjs directory. This problem does not occur on OSX, and all modules are up to date. GET http://localhost:8080/node_modules/rxjs/ 404 (Not F ...

The error "Unable to create an instance of mssql.Schema" indicates that the

Seeking assistance from experienced ReactJS developers to address the issue outlined below. The code provided is based on a tutorial I was following. Despite numerous attempts, I have been unable to resolve the issue. Here is the code snippet from User.js ...