Tuesday, 21 January 2014

Code for video calling using webRTC


Here is the code and step by step procedure how to execute the code
Step1
Download the Zip file or Source Code from then  after opening the folder you will find the following folders.


Step2
After downloading the files add them to the root directory of netbeans
Example
In NETBEANS
·       Video chat
o   Webpages
§  VideoConference.htm
§  Capture.htm
§  captureAndeffects.htm
§  index.jsp
§  websocket-server.js

Here Video chat is web application created in netbeans
After adding files in this manner to the root directory of web application.
Step 3
Download the Node.js from nodejs.org and install it.
Step 4
After installing open the Node.js command prompt and perform the following steps
Go to the directory where websocket-server.js is located from the downloaded souce files.


Then type the following command
Node websocket-server.js

If you get an error like this

it means that websocket server is missing to install this follow the below steps
   npm install websocket@1.0.3
   npm link websocket@1.0.3
   node websocket-server.js

Then server is ready to listen on port 1337.
Step 5
Open the VideoConference.htm page and change the ip address to server ip address where the server has been run.
Example
var socket = new WebSocket('ws://127.0.0.1:1337/');  change ip address don’t delete the port number.
After changing the ip address then it is ready to run
Run the Video Conference.htm
Then it displays the following page