====== AudioRecorder control ======
The AudioRecorder object can be used to listen for sound and record it to a file.
==== Create ====
Create an AudioRecorder object using the CreateAudioRecorder function of the app object:
rec = app.CreateAudioRecorder();
You can use the SetFile function of the AudioRecorder object to set the file to save recorded audio.
rec.SetFile("/sdcard/demo.wav");
The Start method tells it to start recording:
rec.Start();
And the Stop method is for when you have finished recording:
rec.Stop();
==== Methods ====
Some controls use the same methods.\\
For examples of the **[[same methods]]** look here.
^ Method ^ Description ^
| AudioRecorder.GetRMS() | |
| AudioRecorder.GetType() | |
| AudioRecorder.Pause() | |
| AudioRecorder.SetFile( p1 ) | Use the SetFile method to tell the object where to store the sound |
| AudioRecorder.Start( p1 ) | The Start method tells it to start recording |
| AudioRecorder.Stop() | The Stop method is for when you have finished recording |
==== Example ====
function OnStart()
{
rec = app.CreateAudioRecorder();
rec.SetFile( "/sdcard/test.wav" );
rec.Start();
app.ShowPopup("Please speak");
setTimeout(stopit,5000);
}
function stopit()
{
app.ShowPopup("Finished recording");
rec.Stop();
}