O'Reilly logo

PhoneGap Mobile Application Development Cookbook by Matt Gifford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recording audio within your application

The PhoneGap API provides us with the ability to record audio directly within our application, bypassing the native audio recording application.

How to do it...

We will use the Media object to create a reference to an audio file into which we'll record the audio data.

  1. Create the initial layout for your HTML page. This will include the references to the jQuery and jQuery UI JavaScript libraries, the style sheets, and the Cordova JavaScript library. We'll also include an empty script tag block which will contain our custom code. This is shown in the following code block:
    <!DOCTYPE HTML> <html> <head> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required