User Tools

Site Tools


built_in:audiorecorder

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
built_in:audiorecorder [2014/12/18 20:17]
bcarroll [Methods]
built_in:audiorecorder [2018/05/21 07:56] (current)
Line 1: Line 1:
 ====== AudioRecorder control ====== ====== AudioRecorder control ======
-===== Create =====+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: Create an AudioRecorder object using the CreateAudioRecorder function of the app object:
 <code>rec = app.CreateAudioRecorder();</code> <code>rec = app.CreateAudioRecorder();</code>
  
 You can use the SetFile function of the AudioRecorder object to set the file to save recorded audio. You can use the SetFile function of the AudioRecorder object to set the file to save recorded audio.
 +<code>rec.SetFile("/sdcard/demo.wav");</code>
  
-===== Methods ===== +The Start method tells it to start recording: 
-^Method ^Description ^ +<code>rec.Start();</code>
-|AudioRecorder.Record() | | +
-|AudioRecorder.SetFile() | |+
  
 +And the Stop method is for when you have finished recording:
 +<code>rec.Stop();</code>
 +
 +
 +
 +==== 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 ====
 +<code javascript>
 +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();
 +
 +</code>
built_in/audiorecorder.1418933838.txt.gz · Last modified: 2014/12/19 04:17 (external edit)