简体   繁体   English

联网的 A 帧示例切换视频不起作用

[英]Networked A-frame examples toggle video not working

I have created a remix of the Networked A-frame examples project.我创建了 Networked A-frame 示例项目的混音。 I've been testing out some features and for some reason, the toggle video button in the bottom left corner of the screen isn't working on the video example.我一直在测试一些功能,出于某种原因,屏幕左下角的切换视频按钮在视频示例中不起作用。

The function is triggering however it isn't changing the video from on to off and vice versa.该功能正在触发,但它不会将视频从打开更改为关闭,反之亦然。 I'm not sure why this is, but I'm wondering how I can make it so when the button is clicked, if video is on, it will turn off and if video is off, it will turn on.我不确定为什么会这样,但我想知道如何做到这一点,当单击按钮时,如果视频打开,它将关闭,如果视频关闭,它将打开。 How can this be done?如何才能做到这一点? The code is found in public/examples/index.html at line 106 of this project:该代码位于本项目第 106 行的 public/examples/index.html 中:

https://glitch.com/edit/#!/modern-talented-tanker?path=examples%2Findex.html%3A116%3A0 https://glitch.com/edit/#!/modern-talented-tanker?path=examples%2Findex.html%3A116%3A0

Code snippet that isn't working:不起作用的代码片段:

// Handle camera button click (Off and On)
        cameraBtnEle.addEventListener('click', function() {
          NAF.connection.adapter.enableCamera(!cameraEnabled);
          cameraEnabled = !cameraEnabled;
          cameraBtnEle.textContent = cameraEnabled ? 'Hide Camera' : 'Show Camera';
        });
      }

I've looked into the file You linked to, the code snippet found there doesn't match with the one you posted here, it references to the mic element in the linked file.我查看了您链接到的文件,发现其中的代码片段与您在此处发布的代码片段不匹配,它引用了链接文件中的 mic 元素。 What can i suggest is that you look into the example file called basic-video.html .我建议您查看名为basic-video.html的示例文件。 You can find there the correct setup for video sharing in VR space.您可以在那里找到在 VR 空间中进行视频共享的正确设置。 Remember to test it on 2 tabs / windows as if there is only one "player" the video sharing won't work.请记住在 2 个选项卡/窗口上对其进行测试,就好像只有一个“播放器”一样,视频共享不起作用。

For a detailed guide about video sharing in networked-aframe visit this link: https://github.com/networked-aframe/networked-aframe#video有关 networked-aframe 中视频共享的详细指南,请访问此链接: https : //github.com/networked-aframe/networked-aframe#video

This is the example with video sharing:这是视频共享的示例:
https://modern-talented-tanker.glitch.me/basic-video.html https://modern-talented-tanker.glitch.me/basic-video.html

Source code:源代码:
https://glitch.com/edit/#!/modern-talented-tanker?path=examples%2Fbasic-video.html https://glitch.com/edit/#!/modern-talented-tanker?path=examples%2Fbasic-video.html

Good luck!祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM