I want to use camera video feed as background in a-frame, while overlaying objects on it. I know it is possible but I don't know how exactly to do it. so I am here to ask for help!
You can have a simple overlay by adding an element before the scene:
<img src='overlay.jpg' />
<a-scene></a-scene>
fiddle here.
html
<video autoplay></video>
<a-scene></a-scene>
js
// grab the video element
const video = document.querySelector('video');
// this object needs to be an argument of getUserMedia
const constraints = {
video: true
};
// when you grab the stream - display it on the <video> element
navigator.mediaDevices.getUserMedia(constraints).
then((stream) => {video.srcObject = stream});
Fiddle here.