Rate this page:

Peer-to-peer video chat

VoxImplant is a perfect choice if you need to build real-time web-based video chat application in minutes. VoxImplant Web SDK supports WebRTC and lets developers integrate this functionality with any other web application. Peer-to-peer data transfer capabilities available in WebRTC-enabled browsers (Chrome/Firefox/Opera/other) help with the quality of communication (low latency) and scalability. All infrastructure required for WebRTC p2p communication is offered by VoxImplant, including signaling built-in the SDK, STUN/TURN/ICE support, etc. Let's see what steps are required to get simple video chat application up and running.

Creating VoxImplant Application, App Users, App Rule, and VoxEngine Scenario

Before we start building our web app using Web SDK we need to setup Voximplant account. If you don't have one you can get it for free at here. After account activation you will get access to the VoxImplant Control Panel.

Let's open the Applications section of the Control Panel, create a new app and name it videochat. After that go to the Users tab of the application and create two users (for example, testuser1 and testuser2).

Now we need to create the VoxEngine scenario that will process calls between the app users, we can name it User2User:

Scenario code

Scenario code

That's all scenario code we need for peer-to-peer calls between users. But this example doesn't show call control logic that can be implemented in a scenario, so let's check another example:

Scenario code[2]

Scenario code[2]

The last thing we need is to create the application Rule that will tell VoxImplant which scenario should be used for which call. Edit the application, open the Routing tab and create a new rule. Let's name it Intercom, put .* in the Pattern input field (it means we will process all calls using the assigned scenario) and drag'n'drop our User2User scenario to the Assigned scenarios list.

Now we have finished our VoxImplant account setup for the video chat application.

Building web application using Web SDK

For web client we will need voximplant.min.js library (Web SDK), it's available from our CDN and basic understanding of the SDK. We won't put the whole application code here, but you can always grab it from our GitHub page.

SDK code

SDK code

That's all events and functions we need. Of course, it's just plain JS, we need to add HTML/CSS. The app available on our GitHub account looks this way: