How exactly was the web consultation (video calls) set up?
sobes.tech AI
Answer from AI
To set up a web consultation with video calls, WebRTC is usually used — a technology that allows establishing a direct P2P connection between browsers without the need for third-party plugins.
Main setup steps:
-
Signaling: A signaling server (for example, on WebSocket) is needed for exchanging metadata (SDP, ICE candidates) between participants. It does not transmit media but only helps establish the connection.
-
Access to camera and microphone: Access to audio and video is requested via
navigator.mediaDevices.getUserMedia. -
Creating RTCPeerConnection: Objects are created to manage the connection.
-
Exchanging SDP and ICE candidates: The signaling server facilitates the exchange of information to establish the connection.
-
Displaying video: Local and remote videos are displayed in
<video>elements.
An example of simplified code to get video and audio:
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => {
const localVideo = document.getElementById('localVideo');
localVideo.srcObject = stream;
})
.catch(error => console.error('Error accessing camera/microphone:', error));
For full setup, a signaling server and message exchange logic between clients need to be implemented. Ready-made solutions or libraries (e.g., SimplePeer, PeerJS) are often used.