Another handy feature of the iPhone and most Android handsets is the ability to record audio data—perfect for taking audible notes during meetings or those long, boring lectures! In this recipe we are going to capture some audio using the Titanium.Media.AudioRecorder
class, and then allow the user to play back the recorded sound file.
Complete source code for this recipe can be found in the /Chapter 4/Recipe 6
folder.
Note
Note that this recipe will only work for the iPhone. You will also require a physical device for this recipe. Later versions of the Titanium framework should support audio recording for Android via the use of intents. In addition, the iPhone 3G models may not be capable of recording in some of the following compression formats, particularly high fidelity formats such as AAC. When in doubt, you should try using MP4A or WAV formats.