• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sound Recording and Playing in Mobile Media API

 
Walter Mao
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic