动态房间和视频的联网 A 帧问题 [英] Networked A-frame issue with dynamic-room and video

查看:17
本文介绍了动态房间和视频的联网 A 帧问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 A-frame (https://aframe.io) 和 网络 A-frame 组件(https://www.npmjs.com/package/networked-aframe)

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

(项目位于:https://glitch.com/edit/#!/networkedtest?path=public%2Fscene.html%3A44%3A0)

而且我遇到了视频提要的问题.目前在我的项目中,视频源工作得非常好,但是每当我在第 202 行的scene.html 中切换这行代码时:

and I've run into an issue with the video feed. Currently in my project, video feed is working perfectly fine, but whenever 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">
      

使用此代码:

<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">

如果我通过拉起两个选项卡来测试我的代码,视频源应该在的地方只有一个空白的白色平面.我不知道为什么,但是每当我交换 networked-scene="" 行的一部分使用 dynamic-room="" 视频源停止工作,当您加入另一个选项卡时,您看到的只是视频源应在的白屏.

If I test my code by pulling up two tabs, where the video feed should be there is just a blank white plane. I'm not sure why, but whenever I exchange the part of the line networked-scene="" with dynamic-room="" the video feed stops working and when you join on another tab, all you see is a white screen where the video feed should be.

我不确定为什么会发生这种情况,因为我正在更改的是 networked-scene 用于 dynamic-room.我已经尝试通过修改一些代码来修复这个错误,但仍然找不到这个问题的答案.我感觉问题出在 public/js/dynamic-room.component.js 中,但我可能弄错了.

I'm not sure why this is happening since all I'm changing is networked-scene for dynamic-room. I've tried fixing this error by modifying some code but still can't find an answer to this issue. I have a feeling that the issue is somewhere in public/js/dynamic-room.component.js but I may be mistaken.

如果您知道如何解决这个问题,我们将不胜感激.

If you know how to solve this problem, help would be very much appreciated.

链接到我的项目:https:///glitch.com/edit/#!/networkedtest?path=public%2Fscene.html%3A44%3A0

推荐答案

您走在正确的轨道上.

我假设您想使用 dynamic-room 从 URL 加载自定义房间名称.(仅此而已.如果这不是您想要的,那么 dynamic-room 不是您要找的.)

I assume you want to use dynamic-room to load a custom room name from the URL. (That is all it is for. If that is not what you want, then dynamic-room is not what you are looking for.)

动态房间示例读取 URL,然后创建网络场景".组件并将其附加到您的标签.

The dynamic room example reads the URL, then creates the "networked-scene" component for you and attaches it to your tag.

这是一个老例子,写在视频支持之前,所以它不检查 video: true:

It is an old example, written before video support, so it does not check 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('Init networked-aframe with settings:', networkedComp);
el.setAttribute('networked-scene', networkedComp);

我建议将您的参数复制到 dynamic-room.component.js(第 18 行).

I recommend copying your parameters into dynamic-room.component.js (at line 18).

只会从 URL 加载房间名称.(如果未指定,将默认为音频",就像您的网络场景参数一样.)

Only the room name will load from the URL. (And will default to 'audio' if not specified, just like your networked-scene parameter.)

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('Init networked-aframe with settings:', networkedComp);
el.setAttribute('networked-scene', networkedComp);

这篇关于动态房间和视频的联网 A 帧问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆