Tuesday, July 30, 2013

Video Conferencing Project in Java Source Code

My video conferencing project was completed as 300 project for 3rd year.It is not totally completed. There is some bug in here.To solve these bugs and to help other students this project is open.It is first try to make a project open source in this way so it can be modified.Any kind of question against this project will be answered. As this project was created in 3rd year 1st semester and now i nearly completed my BSc. so there will be little description about this.I will try to describe every class and function later when i get the chance.  



For more details and how to build and run go to this link  in github.com.

Latest code and binary release : VideoConference-v1.1
Older code and binary release : VideoConference-v1.0

Fix:
1. When in Video chat the Text chat option hanged for good.


#################################################################################
FEATURE
#################################################################################

1.Multi Chat(Used Threadpole)
2.P2P Chat
3.P2P Audio Chat
4.P2P Video Chat
5.Complete Automated
6.H.263 compression Video
7.raw audio


PREREQUISITE:

1. JUST INSTALL jmf-2.1.1 e



How it will look like -- 

Server:












Client:

 

Client Action:







@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


Details:



ShowMe
======

Video Conferencing Project in Java with JMF.


This is a video conferencing project.It is not fully completed yet.
By this anyone can have a video chat in a same network, can have text chat in any network , also can send file.

#################################################################################
FEATURE
#################################################################################

1. Multi Chat(Used Threadpole)
2. P2P Chat
3. P2P Audio Chat
4. P2P Video Chat
5. Completely Automated
6. H263 compression Video
7. raw audio

Descriptive feature:

i. Text chat, File transfer are done through server, where server is the middle-man or a relay. Meaning, all of the data are goes through the server. So if anyone has the server running on a public IP , then it can be use in any network. This feature is not true for Video chat.


PREREQUISITE:

1. JUST INSTALL jmf-2.1.1 e 32-bit.
2. Require Java SDK installed 32-bit.


Compatibility:

IDE:
1. Tested with JCreator Pro.
2. Tested with Eclipse.


COMPONENT:

1. A Relay Server.
2. A Client.


1. Relay Server:
----------------
```
i.   ClientListener.java
ii.  ClientMap.java
iii. Clients.java
iv.  Main.java
v.   MessageListener.java
vi.  ServerConstant.java
vii. ServerMonitor.java
viii.ServerStatusListener.java
```

2. Client:
----------
```
i.   AVReceive2.java
ii.  AVTransmit2.java
iii. ClientConstant.java
iv.  ClientListListener.java
v.   ClientListPanel.java
vi.  ClientManager.java
vii. ClientStatusListener.java
viii.ClientWindowListener.java
ix.  FileReceiver.java
x.   FileSender.java
xi.  LoginFrame.java
xii. LogInPanel.java
xiii.Main.java
xiv. MessageRecever.java
xv.  MessagingFrame.java
xvi. VideoTransmit.java
```

Configure:
----------

To run this project you must have 3 different PC.
ex:
1. Server PC
2. Client 1 PC
3. Client 2 PC

You also need to install jmf-2.1.1 e in every PC. After that installation you must check your webcam with JMF application available on your PC. If the webcam is accessible through your JMF app then this project will certainly work.

After that you need to build the Server and Client code with the correct IP and Port in file ServerConstant.java and ClientConstant.java. You can build this project with any JAVA IDE. But I have encouraged to use JCreator Pro.

For Server settings in file ServerConstant.java -

```
public interface ServerConstant
{
    public static final int SERVER_PORT=12345;
    public static final int BACKLOG=100;
    public static final int CLIENT_NUMBER=100;
    public static final int MULTICAST_SENDING_PORT=5555;
    public static final int MULTICAST_LISTENING_PORT=5554;
    public static final String MULTICAST_ADDRESS="239.0.0.1";
    public static final String DISCONNECT_STRING="DISCONNECT";
    public static final String MESSAGE_SEPARATOR=" >> ";
   
}
```

SERVER_PORT=12345 is the port in which server is listening/waitting for client.


For Server settings in file ClientConstant.java -
```
public interface ClientConstant
{
    public static final String SERVER_ADDRESS="172.17.0.32";
    public static final int SERVER_PORT=12345;
    public static final int CLIENT_NUMBER=100;
    public static final String DISCONNECT_STRING="DISCONNECT";
    public static final String MESSAGE_SEPARATOR=" >> ";
}
```

SERVER_ADDRESS="172.17.0.32" is the address of the server PC and SERVER_PORT=12345 is the server listening port.

Try Out:
--------

After all of the installation, settings and build just RUN the server on a PC by server Jar or from your IDE run. Then from Server GUI just click on *Start* button.

Now from another 2 PC use the client jar or run from IDE and provide Username on the User window and click *Signin*.
Now you are done. Now any user login in your server can see the other user who are logged in to your server.

Then from friendlist click on the friend and a new window will arise for chat. On that window there will be a video chat start button and a text chat send button. You can use any one for you specific cause.

Troubleshooting:
----------------

If you don't see the video starting please change the value of your webcam's descriptor("vfw://0") on class *MessageRecever.java*

```
AVTransmit2 vt = new AVTransmit2(new MediaLocator("vfw://0"),pt,"20006",null);
AVTransmit2 at = new AVTransmit2(new MediaLocator("javasound://8000"),pt,"20008",null);
```
It may be --

1. vfw://0
2. vfw://1
3. vfw://2 , etc.

JCreator Pro build issue:

If you are using Jcreator you must have to add JMF library path in project properties. It can be done by

*Project->Project Settings->Required Libraries* and add JMF folders library name with location as archive.

Known Issue:

1. We don't have SIP.
2. We don't have STUN, TURN.
3. When in a video call you can't have a text chat session.
4. We don't have any authentication mechanism for user sign in.
5. File transfer is disabled.




44 comments:

  1. Thanx for this code...it is running well but whn i clicked on video it show "Waiting for RTP data to arrive..." can u plz help me in this...and i also want to make the chat application online...can u help me in that ?

    ReplyDelete
    Replies
    1. This means the other end does not ready to start the video capture and send the data to you.

      Delete
  2. tel me details about how to run this code

    ReplyDelete
  3. i ran the server and i ran the client, but after signing with the client it doesn´t show anything but the message you´re connected: 127.0.0.1 (i change the ip in the client constants to my localhost)
    is it supposed to show something else in the client besides signing in??

    ReplyDelete
    Replies
    1. @Raúl Garcia : Are you using 1 PC for both server and Client?
      If so did you set the server end server constant IP/PORT and client end server constant IP/PORT same?

      If you are using one pc I think output is right. Use another instance of client in same pc and see does 2 client exchange there presence or not?

      Delete
  4. I ran the server side code on a different laptop and client side code on a different laptop, but even after successful compilation and running of the code, I am not able to do a video or text chat. After signing in from the client side it simply says, "you are connected to 172.17.0.32" Is it supposed to show anything else?

    ReplyDelete
    Replies
    1. It's ok. Now you need to login in server with another client. Then you can see one another from both client and can make call by clicking on the call/video button.

      Delete
    2. Thanks a lot for your reply. I did as you said and now I can see buddy list and option to video call and chat. But we are facing another problem, messages from one client are not reaching another client. Like when one client types "hi", it goes to the server, it is seen there but it doesn't reaches the other client. Further, one one client and server we are not able to run jmf as it has compatibility issues with 64 bit os. So is my problem arising due to compatibility issues of jmf or we nee to do something more?

      Delete
    3. how can we run this code in different laptops

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. sir i have tried to run conferencing program on 1 laptop....and 1 server and conferencing program on another laptop...i have created adhoc network...also..
    still when i login with some name..then it shows on command prompt user log in...but it does nt shows any login window...and no info on other side laptop servr..what is the issue....i m not able to resolve..do i need to change ip and port..plz tell me how to deal with it
    i need sequential steps...

    ReplyDelete
    Replies
    1. If it may help, see you need to get a hub or switch before you can perform this project. You have to run only server side code on one laptop, run only client side code on another laptop and then run client side code on another laptop. Connect all these three laptops by a hub or a switch. Give them manual ip. The ip of server is defined to be 172.17.0.32 with default sub-net mask 255.255.0.0 and don't give any dns server or default gateway. The ip's of other two client should be in the same subnet, so that they can communicate with each other, I gave the ip's as 172.17.0.35 and 172.17.0.37. After you have done so, you can run the codes on the respective pc's and voila! you will see the log in page and after the two clients log in they can chat with each other.

      Delete
  8. when i run the server ans client i have no server found !! can you help mee please

    ReplyDelete
    Replies
    1. Anshul DupareApril 16, 2014 at 2:03 PM

      If it may help, see you need to get a hub or switch before you can perform this project. You have to run only server side code on one laptop, run only client side code on another laptop and then run client side code on another laptop. Connect all these three laptops by a hub or a switch. Give them manual ip. The ip of server is defined to be 172.17.0.32 with default sub-net mask 255.255.0.0 and don't give any dns server or default gateway. The ip's of other two client should be in the same subnet, so that they can communicate with each other, I gave the ip's as 172.17.0.35 and 172.17.0.37. After you have done so, you can run the codes on the respective pc's and voila! you will see the log in page and after the two clients log in they can chat with each other.

      Delete
  9. it is running well but when i clicked on video it show "Waiting for RTP data to arrive..." can u please help me in this?

    ReplyDelete
  10. hi sir i try ur cod eit is working. but when i click on video button. then it will show error like this..Track 0 is set to transmit as:
    dvi/rtp, 8000.0 Hz, 4-bit, Mono
    Created RTP session: 127.0.0.1 20004
    Error : Couldn't set any of the tracks to a valid RTP format...

    plz help me..
    i want to use it on one to many system.is it work or not..

    ReplyDelete
    Replies
    1. Configure your IP settings correctly and use the latest code. Follow me on github.com https://github.com/robelsharma. I have committed a latest fix for a previous issue. *127.0.0.1* is localhost not a valid IP. Again you can test 2 client in one machine.

      Delete
  11. Sir I have one problem . I couldn't see the video. Actually do I need to run the clients in different PC's to see the video or running the different clients in the same PC, will it do?
    Please help me with it.

    ReplyDelete
    Replies
    1. You have to use 2 different PC for client. The both clients' IP must be reachable from one another. (Just Ping your one client IP from another client.)

      Delete
  12. I try to run this code.but I cannot import the messangerclient package in the client side code.so can you help me wit this?

    ReplyDelete
    Replies
    1. I have tested it with both Jcreator Pro and eclipse and it seems working. If you have Jcreator pro the available source code has the project file named Video Conferencing2.jcw . You just need to click it!!

      Delete
    2. Can you please explain the role of server in this code.

      Delete
    3. Server is used for presence, text chat and for client IP exchange.

      Delete
  13. Hi Robel ! i have this problem
    *********VIDEO CHAT Thread started :)
    Cannot open audio device for input: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
    Cannot open audio device for input: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
    java.io.IOException: line with format PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.********* can you help me please ?!

    ReplyDelete
    Replies
    1. The project is failing to use the audio capture and video capture device from your system. Please run the JMF manager and see is the video and audio device is available on the list.

      Delete
  14. how i can connect to the server

    ReplyDelete
    Replies
    1. Set the IP address of your PC on server constant class. Then build and Run and Start server.
      Now from client GUI just give the server IP and connect to it.

      Delete
  15. how i can use JMF studio to run the project

    ReplyDelete
  16. how i can use JMF studio to run the project

    ReplyDelete
    Replies
    1. On the description I have pointed out that you have to install jmf and on jmf manager application you have to set and get the webcam. I am quoting my point bellow --
      "You also need to install jmf-2.1.1 e in every PC. After that installation you must check your webcam with JMF application available on your PC. If the webcam is accessible through your JMF app then this project will certainly work."

      Delete
  17. Can you help me or give me any tips how to make multiple users chatting and video?!

    ReplyDelete
    Replies
    1. Sorry Taulant. This project says video conferencing but only p2p one is complete. But multiple user chat is ok.

      Delete
    2. I have an error when im trying to open video with jmf.When i run at my laptop it shows this error "Exception in thread "VFW Request Thread"" but not in my pc.Is it problem with jmf with 64 bit?! And how to modify for multiple user for chat?

      Delete
    3. For multiuser chat I guess you have to do some change on code, because on GUI it is not enabled.

      Delete
  18. This comment has been removed by a blog administrator.

    ReplyDelete
  19. what protocol did you used for video conference ?

    ReplyDelete
  20. hello there bro. i managed to get the video and everything running. thank you so much.

    ReplyDelete
  21. Can you help me !
    Don't start call video =(
    Cannot open audio device for input: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
    Cannot open audio device for input: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
    java.io.IOException: line with format PCM_SIGNED 8000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
    - Open RTP session for: addr: 192.168.4.105 port: 20002 ttl: 1
    /192.168.4.105/20002
    Cannot create the RTP Session: Can't open local data port: 20002
    Failed to initialize the sessions.
    Error : Couldn't create DataSource

    ReplyDelete

How to Generate and use the ssh key on Gerrit, github.io, gitlab, and bitbucket.

 Details can be found here -