Voice Communication using Java applet
Hello to all
My company and I am in need of a Voice communication Java web applet that
would allow our clients to have a real-time voice conversation over the internet
with one of our support team specialists. We have looked all over the interenet
and have not found what we are looking for. Does anyone in this newsgroup
know of a product which can do this specific function and not require the
user to install any third party software on their system? If not, does anyone
know which Java package may provide an API for voice communication? Any
help will be greatly appreciated.
Regards
Rey
Re: Voice Communication using Java applet
Rey,
The Java Media Framework may be the only answer, since this type of activity
requires hardware level access. I am surprised to say, that I am not aware
of an applet or Java based application that provides this functionality.
Using the JMF would require that anyone who wants to use the voice application
have the JMF installed on their PC. Maybe someone else knows of a better
way. I would also be curious to know.
Good Luck,
Rob
"Rey Morejon" <ivanco@yahoo.com> wrote:
>
>Hello to all
>
>My company and I am in need of a Voice communication Java web applet that
>would allow our clients to have a real-time voice conversation over the
internet
>with one of our support team specialists. We have looked all over the interenet
>and have not found what we are looking for. Does anyone in this newsgroup
>know of a product which can do this specific function and not require the
>user to install any third party software on their system? If not, does
anyone
>know which Java package may provide an API for voice communication? Any
>help will be greatly appreciated.
>
>Regards
>
>Rey
Re: Voice Communication using Java applet
Rey,
As a quick addition to Rob's response:
I've implemented a full-duplex, streaming voice-over-IP (VOIP) solution in
Java 2 SDK 1.3 using only the JavaSound API (part of the standard SDK 1.3).
This is fairly simple to do, but I assume (judging by your posting) that
your customers aren't willing to install the latest Java plug-in if they
are conected by a 56K dialup. In this case, I'll have to give you a big
"duh-uh" because with all the JDK 1.1 applet permission issues and voice
recording issues, the solution would seem like a real pain (unless of course
you could add on the JMF as Rob said). If you decide to pursue the Java
2 SDK 1.3 solution, drop me an e-mail and I'll give you a one page summary
about how to do it yourself without paying someone else to do it.
David Ditzenberger
david@ditzenberger.com
"Rob Abbe" <rabbe@captovation.com> wrote:
>
>Rey,
>
>The Java Media Framework may be the only answer, since this type of activity
>requires hardware level access. I am surprised to say, that I am not aware
>of an applet or Java based application that provides this functionality.
> Using the JMF would require that anyone who wants to use the voice application
>have the JMF installed on their PC. Maybe someone else knows of a better
>way. I would also be curious to know.
>
>Good Luck,
>
>Rob
>
>"Rey Morejon" <ivanco@yahoo.com> wrote:
>>
>>Hello to all
>>
>>My company and I am in need of a Voice communication Java web applet that
>>would allow our clients to have a real-time voice conversation over the
>internet
>>with one of our support team specialists. We have looked all over the
interenet
>>and have not found what we are looking for. Does anyone in this newsgroup
>>know of a product which can do this specific function and not require the
>>user to install any third party software on their system? If not, does
>anyone
>>know which Java package may provide an API for voice communication? Any
>>help will be greatly appreciated.
>>
>>Regards
>>
>>Rey
>
Re: Voice Communication using Java applet
Because of the overwhelming e-mail response I've received regarding coding
voip in Java 2 sdk 1.3, I'll post a solution summary to this newsgroup (right
now I'm swamped at work and during the evenings so it will be a couple of
days). Technologies to start looking at for example code include:
1. CapturePlayback.java (which I believe is found in JavaSound.jar in the
Java 2 SDK 1.3 release, in the "demo/sound" directory, but don't quote me
on that).
2. Any tutorial on signing applets for the Java plug-in. (You only need
to look at this if you're looking at an applet solution). Make sure that
you look at the VERY LATEST information on this because the methods have
changed recently.
3. Peer-to-peer examples such as limewire.org and IBM's Babblenet. (You
only need to look at examples like these if interested in a peer-to-peer
solution). Some (not all) instant messaging/chat examples can be useful
because you'll be streaming byte arrays instead of text.
4. Tunneling examples. (You only need to look at these if planning upon
an applet-servlet solution, for a system such as real-time online voice help
/ tech support).
5. Audio compression tutorials and examples. There are tons if Java source
code examples out there on sourceforge.net that will convert sound streams
to a more compact format (such as GSM). This is useful when trying to conserve
bandwidth, wireless solutions, dial-up connections, etc.
While I'm very comfortable with Java, XML, and J2EE technologies in general,
I'm probably more of a novice concerning JavaSound, streaming, peer-to-peer,
etc. Perhaps one of the more advanced developers in this area can take the
solution and run with it (preferably open source so that all developers can
benefit). Whatever the case, I have a tested and working solution but it
has been hacked together because of a short development time, so it can probably
be significantly improved.
That's it for now...more later.
David
"David Ditzenberger" <david@ditzenberger.com> wrote:
>
>Rey,
>
>As a quick addition to Rob's response:
>
>I've implemented a full-duplex, streaming voice-over-IP (VOIP) solution
in
>Java 2 SDK 1.3 using only the JavaSound API (part of the standard SDK 1.3).
> This is fairly simple to do, but I assume (judging by your posting) that
>your customers aren't willing to install the latest Java plug-in if they
>are conected by a 56K dialup. In this case, I'll have to give you a big
>"duh-uh" because with all the JDK 1.1 applet permission issues and voice
>recording issues, the solution would seem like a real pain (unless of course
>you could add on the JMF as Rob said). If you decide to pursue the Java
>2 SDK 1.3 solution, drop me an e-mail and I'll give you a one page summary
>about how to do it yourself without paying someone else to do it.
>
>David Ditzenberger
>david@ditzenberger.com
>
>
>
>"Rob Abbe" <rabbe@captovation.com> wrote:
>>
>>Rey,
>>
>>The Java Media Framework may be the only answer, since this type of activity
>>requires hardware level access. I am surprised to say, that I am not aware
>>of an applet or Java based application that provides this functionality.
>> Using the JMF would require that anyone who wants to use the voice application
>>have the JMF installed on their PC. Maybe someone else knows of a better
>>way. I would also be curious to know.
>>
>>Good Luck,
>>
>>Rob
>>
>>"Rey Morejon" <ivanco@yahoo.com> wrote:
>>>
>>>Hello to all
>>>
>>>My company and I am in need of a Voice communication Java web applet that
>>>would allow our clients to have a real-time voice conversation over the
>>internet
>>>with one of our support team specialists. We have looked all over the
>interenet
>>>and have not found what we are looking for. Does anyone in this newsgroup
>>>know of a product which can do this specific function and not require
the
>>>user to install any third party software on their system? If not, does
>>anyone
>>>know which Java package may provide an API for voice communication? Any
>>>help will be greatly appreciated.
>>>
>>>Regards
>>>
>>>Rey
>>
>
Re: Voice Communication using Java applet
Thanks David. I understand the swamped thing. I was thinking about doing
the same sort of thing but didn't have the time to do it and didn't have
all the pieces to the puzzle.
Mark
"David Ditzenberger" <david@ditzenberger.com> wrote:
>
>Because of the overwhelming e-mail response I've received regarding coding
>voip in Java 2 sdk 1.3, I'll post a solution summary to this newsgroup (right
>now I'm swamped at work and during the evenings so it will be a couple of
>days). Technologies to start looking at for example code include:
>
>1. CapturePlayback.java (which I believe is found in JavaSound.jar in the
>Java 2 SDK 1.3 release, in the "demo/sound" directory, but don't quote me
>on that).
>2. Any tutorial on signing applets for the Java plug-in. (You only need
>to look at this if you're looking at an applet solution). Make sure that
>you look at the VERY LATEST information on this because the methods have
>changed recently.
>3. Peer-to-peer examples such as limewire.org and IBM's Babblenet. (You
>only need to look at examples like these if interested in a peer-to-peer
>solution). Some (not all) instant messaging/chat examples can be useful
>because you'll be streaming byte arrays instead of text.
>4. Tunneling examples. (You only need to look at these if planning upon
>an applet-servlet solution, for a system such as real-time online voice
help
>/ tech support).
>5. Audio compression tutorials and examples. There are tons if Java source
>code examples out there on sourceforge.net that will convert sound streams
>to a more compact format (such as GSM). This is useful when trying to conserve
>bandwidth, wireless solutions, dial-up connections, etc.
>
>While I'm very comfortable with Java, XML, and J2EE technologies in general,
>I'm probably more of a novice concerning JavaSound, streaming, peer-to-peer,
>etc. Perhaps one of the more advanced developers in this area can take
the
>solution and run with it (preferably open source so that all developers
can
>benefit). Whatever the case, I have a tested and working solution but it
>has been hacked together because of a short development time, so it can
probably
>be significantly improved.
>
>That's it for now...more later.
>David
>
>
>
>"David Ditzenberger" <david@ditzenberger.com> wrote:
>>
>>Rey,
>>
>>As a quick addition to Rob's response:
>>
>>I've implemented a full-duplex, streaming voice-over-IP (VOIP) solution
>in
>>Java 2 SDK 1.3 using only the JavaSound API (part of the standard SDK 1.3).
>> This is fairly simple to do, but I assume (judging by your posting) that
>>your customers aren't willing to install the latest Java plug-in if they
>>are conected by a 56K dialup. In this case, I'll have to give you a big
>>"duh-uh" because with all the JDK 1.1 applet permission issues and voice
>>recording issues, the solution would seem like a real pain (unless of course
>>you could add on the JMF as Rob said). If you decide to pursue the Java
>>2 SDK 1.3 solution, drop me an e-mail and I'll give you a one page summary
>>about how to do it yourself without paying someone else to do it.
>>
>>David Ditzenberger
>>david@ditzenberger.com
>>
>>
>>
>>"Rob Abbe" <rabbe@captovation.com> wrote:
>>>
>>>Rey,
>>>
>>>The Java Media Framework may be the only answer, since this type of activity
>>>requires hardware level access. I am surprised to say, that I am not
aware
>>>of an applet or Java based application that provides this functionality.
>>> Using the JMF would require that anyone who wants to use the voice application
>>>have the JMF installed on their PC. Maybe someone else knows of a better
>>>way. I would also be curious to know.
>>>
>>>Good Luck,
>>>
>>>Rob
>>>
>>>"Rey Morejon" <ivanco@yahoo.com> wrote:
>>>>
>>>>Hello to all
>>>>
>>>>My company and I am in need of a Voice communication Java web applet
that
>>>>would allow our clients to have a real-time voice conversation over the
>>>internet
>>>>with one of our support team specialists. We have looked all over the
>>interenet
>>>>and have not found what we are looking for. Does anyone in this newsgroup
>>>>know of a product which can do this specific function and not require
>the
>>>>user to install any third party software on their system? If not, does
>>>anyone
>>>>know which Java package may provide an API for voice communication?
Any
>>>>help will be greatly appreciated.
>>>>
>>>>Regards
>>>>
>>>>Rey
>>>
>>
>
Re: Voice Communication using Java applet
Sorry about the lack of a posting late last week if anybody is still following
this thread. In the mean time, I've been told that I cannot post snippets
of code because I did the applet voip coding for a project at work (not my
intellectual property...you know how it goes). Anyway, I can give general
pointers as in my last posting, but that's about it. If you can any specific
questions, I'll be happy to do my best at answering them. Whatever the case,
here's how I proceeded with the development:
1. Grab the JavaSound.jar file and extract the CapturePlayback.java file.
In that, you'll see two threads -- one for capture and one for playback.
You'll definitely need to start up a thread for recording. Threading for
playback is optional, but suggested. You can actually ditch a majority of
the code in the CapturePlayback.java file and write your own GUI or specify
your own command line parameters. Beware that, unlike the Java Media Framework
(JMF), the JavaSound API (subset) is a bit more picky about the sound formats
in which you record.
2. In the Capture example, the sound data is read into a byte array. This
array can be directly trasmitted over the net to the peer if you have a broadband
connection, but I recommend "squelching", and either compressing the data
using standard compression algorithms or grab some wave/gsm conversion code
off the net. Supposedly, there's some "set..." function you can call to
only record audio above a certain threshold (volume level), but I couldn't
get it to work...it always returned -1. Rather than use that function, I
"squelched" about every 10th byte (otherwise, too much data to analyze).
3. I supect that the network comms you will have the least amount of issues
with because there are quite a bit of tunneling examples out there (for applet/servlet
communication) and quite a bit of open source peer-to-peer examples on sourceforge
and IBM's alphawork's site.
Once again if you have any other specific ideas/questions let me know. Hopefully,
a developer with a lull in his/her schedule can publish an open source project
as an example of voice-over-ip in Java. Perhaps this could be integrated
in to IBM's Babblenet, Jabber, LimeWire, or an example JXTA project. Cheers
for now...talk to you later.
David
"Rey Morejon" <ivanco@yahoo.com> wrote:
>
>Hello to all
>
>My company and I am in need of a Voice communication Java web applet that
>would allow our clients to have a real-time voice conversation over the
internet
>with one of our support team specialists. We have looked all over the interenet
>and have not found what we are looking for. Does anyone in this newsgroup
>know of a product which can do this specific function and not require the
>user to install any third party software on their system? If not, does
anyone
>know which Java package may provide an API for voice communication? Any
>help will be greatly appreciated.
>
>Regards
>
>Rey
Re: Voice Communication using Java applet
David,
Thanks for taking the time and for the info. I'm pretty busy too but I'll
try to find some time to give it a whirl.
Mark
"David Ditzenberger" <david@ditzenberger.com> wrote:
>
>Sorry about the lack of a posting late last week if anybody is still following
>this thread. In the mean time, I've been told that I cannot post snippets
>of code because I did the applet voip coding for a project at work (not
my
>intellectual property...you know how it goes). Anyway, I can give general
>pointers as in my last posting, but that's about it. If you can any specific
>questions, I'll be happy to do my best at answering them. Whatever the
case,
>here's how I proceeded with the development:
>
>1. Grab the JavaSound.jar file and extract the CapturePlayback.java file.
> In that, you'll see two threads -- one for capture and one for playback.
> You'll definitely need to start up a thread for recording. Threading for
>playback is optional, but suggested. You can actually ditch a majority
of
>the code in the CapturePlayback.java file and write your own GUI or specify
>your own command line parameters. Beware that, unlike the Java Media Framework
>(JMF), the JavaSound API (subset) is a bit more picky about the sound formats
>in which you record.
>2. In the Capture example, the sound data is read into a byte array. This
>array can be directly trasmitted over the net to the peer if you have a
broadband
>connection, but I recommend "squelching", and either compressing the data
>using standard compression algorithms or grab some wave/gsm conversion code
>off the net. Supposedly, there's some "set..." function you can call to
>only record audio above a certain threshold (volume level), but I couldn't
>get it to work...it always returned -1. Rather than use that function,
I
>"squelched" about every 10th byte (otherwise, too much data to analyze).
>3. I supect that the network comms you will have the least amount of issues
>with because there are quite a bit of tunneling examples out there (for
applet/servlet
>communication) and quite a bit of open source peer-to-peer examples on sourceforge
>and IBM's alphawork's site.
>
>Once again if you have any other specific ideas/questions let me know.
Hopefully,
>a developer with a lull in his/her schedule can publish an open source project
>as an example of voice-over-ip in Java. Perhaps this could be integrated
>in to IBM's Babblenet, Jabber, LimeWire, or an example JXTA project. Cheers
>for now...talk to you later.
>
>David
>
>
>"Rey Morejon" <ivanco@yahoo.com> wrote:
>>
>>Hello to all
>>
>>My company and I am in need of a Voice communication Java web applet that
>>would allow our clients to have a real-time voice conversation over the
>internet
>>with one of our support team specialists. We have looked all over the
interenet
>>and have not found what we are looking for. Does anyone in this newsgroup
>>know of a product which can do this specific function and not require the
>>user to install any third party software on their system? If not, does
>anyone
>>know which Java package may provide an API for voice communication? Any
>>help will be greatly appreciated.
>>
>>Regards
>>
>>Rey
>
My voip creation (bit working) ... what now ?
Hello :WAVE:
I have here the "test applet" http://84.244.8.225/test.html
Maybe its usefull..???
Here the source:
import java.awt.*;
import java.applet.*;
import java.io.*;
import java.net.*;
import javax.sound.sampled.*;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;
public class Talk extends Applet implements Runnable{
static final long serialVersionUID = -116069779446114664L;
Button b1,b2;
TextArea ta,ta2;
TextField t1;
Socket sok,sok2;
String adres,adres2,lees;
TargetDataLine tdl;
SourceDataLine sdl;
AudioFormat af,af2;
DataOutputStream dup;
DataInputStream dip;
int poort,poort2,time,speak;
Thread tstart,t2start;
Cursor c1,c2;
InputStream ins;
OutputStream uits;
InputStreamReader ir;
BufferedReader buf;
PrintWriter pw;
public void init()
{
adres="84.244.8.225";
poort=4433;
adres2="84.244.8.225";
poort2=4434;
ta=new TextArea("");
ta.setSize(200, 100);
ta.setLocation(10, 10);
ta2=new TextArea("");
ta2.setSize(200, 100);
ta2.setLocation(10, 10);
add(ta2);
b1=new Button("Connect");
b1.setSize(40, 60);
b1.setLocation(100, 10);
add(b1);
b2=new Button("Send");
b2.setSize(40, 60);
b2.setLocation(180, 120);
add(b2);
t1=new TextField("");
t1.setSize(160, 60);
t1.setLocation(10, 120);
add(t1);
this.setBackground(Color.BLUE);
c1=new Cursor(Cursor.HAND_CURSOR);
c2=new Cursor(Cursor.DEFAULT_CURSOR);
t2 st2=new t2();
st2.start();
t st=new t();
st.start();
}
class t extends Thread{
private AudioFormat ad1(){
float sr = 8000.0F;
int szb = 16;
int ch = 1;
boolean sig = true;
boolean big = false;
return new AudioFormat(sr,szb,ch, sig, big);
}
public void run(){
while(true){
if(speak==1){
try{
AudioFormat af = ad1();
DataLine.Info inf=new DataLine.Info(TargetDataLine.class,af);
tdl=(TargetDataLine)AudioSystem.getLine(inf);
dup=new DataOutputStream(sok.getOutputStream());
tdl.open(af);
tdl.start();
byte[] d=new byte[1024];
int b=tdl.read(d, 0,1024);
dup.write(d,0,b);
dup.flush();
}catch(Exception ex2){
ta.setText(ta.getText()+"\r\n"+"No data dup");
}
time=time+1;
repaint();}
}
}
}
class t2 extends Thread{
private AudioFormat ad2(){
float sr = 8000.0F;
int szb = 16;
int ch = 1;
boolean sig = true;
boolean big = false;
return new AudioFormat(sr,szb,ch, sig, big);
}
public void run(){
while(true){
try{
InputStream ins=sok2.getInputStream();
ir=new InputStreamReader(ins);
buf=new BufferedReader(ir);
lees=buf.readLine();
if(lees.startsWith("tekst")){
ta2.setText(ta2.getText()+"\r\n"+lees.substring(5,lees.length()));
}
}catch(Exception ex){}
try{
byte[] d2=new byte[1024];
AudioFormat af2 = ad2();
DataLine.Info inf2=new DataLine.Info(SourceDataLine.class,af2);
sdl=(SourceDataLine)AudioSystem.getLine(inf2);
dip=new DataInputStream(sok.getInputStream());
int tc=dip.read(d2,0,1024);
if(tc>0){
sdl.stop();
sdl.close();
sdl.open(af2);
sdl.start();
sdl.write(d2, 0, 1024);
ta.setText(ta.getText()+"\r\n"+"--"+d2);
}
time=time+1;
repaint();
}catch(Exception ex3){
ta.setText(ta.getText()+"\r\n"+"Error data dip");
}
}
}
}
public void start(){
}
public void run(){
}
public boolean action(Event e,Object o){
if(e.target.equals(b1)){
try{
sok=new Socket(adres,poort);
sok2=new Socket(adres2,poort2);
b1.setVisible(false);
}catch(Exception ex4){}
}
if(e.target.equals(b2)){
try{
OutputStream uits=sok.getOutputStream();
pw=new PrintWriter(uits,false);
}catch(Exception ex5){}
}
return true;
}
public boolean mouseMove(Event evt,int x,int y){
if(x>100 && x<180 && y>210 && y<270){
this.setCursor(c1);
}else{this.setCursor(c2);}
return true;
}
public boolean mouseDown(Event evt,int x,int y){
if(x>100 && x<180 && y>210 && y<270){
this.setCursor(c2);
speak=1;
}else{speak=0;
this.setCursor(c1);}
return true;
}
public boolean mouseUp(Event evt,int x,int y){
if(x>100 && x<180 && y>210 && y<270){
speak=0;
this.setCursor(c2);
}else{speak=0;
this.setCursor(c1);
}
return true;
}
public boolean keyUp(Event ek,int k){
if(k==Event.ENTER){
}
return true;
}
public void paint (Graphics g){
g.drawString("thread: "+time,2,12);
g.drawString("PUSH TO TALK ",90,240);
g.drawString("First press Connect button ! ",10,220);
g.setColor(Color.ORANGE);
g.drawRect(100, 210, 80, 60);
}
}
/// Any tip to make it better/working ?
//Thx !