Skip to content

Full Example: RTC Video Chat ​

The RTC Video Chat page connects two browsers directly for video, audio and text with WebRTC, with Skapi doing the signaling over its realtime connection. It needs a logged-in user, and WebRTC works over HTTPS or on localhost. Open it in another browser or device with a second account and call each other.

Enter your project ID to open the demo.

You need your project ID to open the demo.

What it demonstrates ​

FeatureHow the page does it
Finding each otherEvery visitor of the page joins the realtime group RTCCall; getRealtimeUsers() and the USER_JOINED and USER_LEFT notices keep a table of the other users online, with their connection IDs.
CallingconnectRTC() with the other user's connection ID and the chosen media (video, audio). The call's connection promise resolves once the other side accepts.
Receiving a callThe callee gets an rtc:incoming realtime message and answers it with connectRTC() on that message to accept, or hangup() to reject.
The streamsThe track event carries the other user's media stream into a video element; the caller's own stream is shown muted.
Text over the data channelMessages typed on the page are sent over the connection's default data channel, straight between the two browsers, and shown on both sides.
Hanging uphangup() on either side ends the call; the connectionstatechange event returns both pages to the user list.

Download ​

The page is part of the full template: skapi-templates.zip. See Full Examples for how to run it.