I have been experimenting with the Networked A-frame examples project and created a remix of it. I encountered an issue where the toggle video button at the bottom left corner of the screen is not functioning properly in the video example.
Although the function is being triggered, the video is not switching from on to off or vice versa. I am unsure of the reason behind this issue and am seeking advice on how to modify it so that when the button is clicked, it will toggle the video on if it's off, and off if it's on. How can I achieve this? The specific code snippet causing the problem can be found in public/examples/index.html at line 106 of this project:
Code snippet that needs fixing:
// 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';
});
}