Two Laptop Bag*
The moose likes Java Micro Edition and the fly likes Sound Recording and Playing in Mobile Media API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Sound Recording and Playing in Mobile Media API" Watch "Sound Recording and Playing in Mobile Media API" New topic
Author

Sound Recording and Playing in Mobile Media API

Walter Mao
Greenhorn

Joined: Oct 09, 2002
Posts: 2
Hello.
I want to write an application to record and play voice in cellphones using Mobile Media API. My recording function is like this:
try {
// Create a Player that captures live audio.
Player p = Manager.createPlayer("capture://audio");
p.realize();
// Get the RecordControl, set the record stream,
// start the Player and record for 5 seconds.
RecordControl rc = (RecordControl)p.getControl("RecordControl");
ByteArrayOutputStream output = new ByteArrayOutputStream();
rc.setRecordStream(output);
rc.startRecord();
p.start();
Thread.currentThread().sleep(5000);
rc.commit();
p.close();
} catch (IOException ioe) {
} catch (MediaException me) {
} catch (InterruptedException ie) { }
I want to record the voice into a file and store it in cellphone database. How do I do that? Where do I put it in? In this example, I record from web server. That's not what I want. Voice should be an InputStream or DataSource? What is the difference between the two? I want some code examples.
Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sound Recording and Playing in Mobile Media API