I am trasnmittin the video captureStream using signaling server but it seems to be not working at all, I dont know what I am missing or am I doing it wrong I am using the capturestream webrtc, Here is the code that I tried so far, Can anyone check it because Im getting blank on the client side. But if I tried the the navigator.mediaDevices.getDisplayMedia(constraint). It works but it I use the code below its seem to be not working...
Here is the code I tried
Video:
<video preload="auto" playsinline autoplay id="tvideo"
<source src="video.mp4" type="video/mp4"></source>
</video>
Js file
const tvideo = document.getElementById('tvideo');
const stream = tvideo.addEventListener('canplay', () => {
let stream;
const fps = 0;
if (tvideo.captureStream) {
stream = tvideo.captureStream(fps);
} else if (tvideo.mozCaptureStream) {
stream = tvideo.mozCaptureStream(fps);
} else {
console.error('Stream capture is not supported');
stream = null;
}
});
stream => {
tvideo.srcObject = stream;
socket.emit("broadcaster");
};
Reciever is all good I think
socket.on("broadcaster", () => {
socket.emit("watcher");
});