Answer the question
In order to leave comments, you need to log in
How to send a webRTC track to JS?
Tell me, please, I'm trying to broadcast video from the browser to the server via webRTC.
It seems that it was possible to establish a connection between the front (js) and the server (go) via webRTC. Implemented all the way with installing sdp and iceCandidate. But I do not really understand how to understand whether the connection has been established.
On the server there is an ontrack handler (in the lib that I use there). On js, I'm trying to add a track to peerConnection, but it says that it already exists and there really is a webcam, but nothing comes to the server in the handler.
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => {
localVideo.srcObject = stream;
stream.getTracks().forEach(track => localPeerConnection.addTrack(track));
localPeerConnection.createOffer().then(createdOffer).catch(setSessionDescriptionError)
}).catch(log);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question