Solved

Applet to capture audio and save .wav at the web server

Posted on 2000-02-19
7
340 Views
Last Modified: 2012-06-27
Hi,
   I have developed an applet that captures audio from mic
   and saves sound on the client machine. However, I need to
   to store this file at the web server, without creating any
   file at the web server.

   Can anyone help me out ?

regards,
Raghu.
0
Comment
Question by:raghurani
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Author Comment

by:raghurani
ID: 2539337
More details :

I do not wish to go for RTP as it does not guarantee no-loss transmission. More over, I do NOT wish to
play the sound at the web-server, on the fly. I just need to save it as a file.
0
 
LVL 8

Expert Comment

by:diakov
ID: 2539498
"...However, I need to
   to store this file at the web server, without creating any
   file at the web server..."

This is a bit difficult to understand.

The applet actually runs on the client machine, and you need something at the server side to be able to accept the data stream you send to it and save it to a file.
You can ise a servlet, CGI program, separate application that listens on a socket, etc.

Servlet would be the best choice.

Cheers,
  Nik
0
 
LVL 7

Accepted Solution

by:
Ravindra76 earned 200 total points
ID: 2539692
I agree with diakov

Ur comments
>>

"...However, I need to
   to store this file at the web server, without creating any
   file at the web server..."

is not clear.

Storing the file at webserver without creating any file is confusing..

If U want applet to write to webserver
see the below text otherwise ignore my comment..
Write all the code in servlet to write into the file.
Call this servlet from applet by using URLConnection class.

I think You know the syntax of connecting applet to servlet

URLConnection conn = new URL("http://yoursite:yourport/servlet/YourServlet"').openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.connect();

Nothing to do in your applet because all will handle by servlet


Your servlet basically contains the following code

// Write code to inport necessary.

public class YourServlet extends HttpServlet {

   // Write code for init method if needed
  // write code for service or doget or dopost method depending on your strategy

public void service(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException {

  String filename = "a.txt";
  /* If you want filename from applet,append it like this in your appletcode

   URL url = new URL("http://yoursite:yourport/servlet/yourservlet?filename=a.txt");
    URLConnection =  url.openConnection(); */
// in this case

 // String filename = req.getParameter("filename");
   
// Write normal code to open file and print it.Put it in try,catch block

 FileWriter fw = new FileWriter(filename);
 fw.pritln("HelloWorld")
   



 
Comment  
From: mbormann
 Date: Friday, October 22 1999 - 11:00PM CST    
(1)
http://www.j-nine.com/pubs/applet2servlet/index.htm 
http://www.devx.com/upload/free/features/javapro/1999/05may99/lo0599/lo0599.asp 

(2)
http://www.servletsource.com/code/writefile.html 
http://www.servletsource.com/code/ReadFile.html

 
Best of luck
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:diakov
ID: 2539739
Well, a database on the server is also an option, then a direct JDBC connection (depends on the DBMS) or again through a servlet are the possibilities.

Nik
0
 
LVL 1

Author Comment

by:raghurani
ID: 2553349
Well,

  I need to capture the audio and save it in a file
  at the server end. I am able to capture the sound
  & store it in javax.sound.sampled.AudioInputStream.
  However I was not able to pass it no to the servlet
  as it requires the object to be serialized. For this I
  "wrapped" AudioInputStream object in my own
  defined AudioStream object. But, the error continues
  to exist and expects AudioInputStream object also
  to be serialized.

  How can I overcome this ?

  I understand that this question is out of the scope.
  I would be glad if you friends can give me some
  pointers.
  I am sure to close this question as soon as my
  this comment is addressed. Any helpful URLs
  are also welcome.

  Thanks for the support.

regards,
Raghu
0
 
LVL 1

Author Comment

by:raghurani
ID: 2578970
Thanks for the excellent work, ravindra76.
Congrats and sorry for the delay.
0
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2582858
No Problem

:) :) :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now