Capturing Audio in PhoneGap

0
4337

In this tutorial we will be creating an app which will have the recording functionality , so we will have a record button which when pressed will record the audio file for us .

  • To create an app with functionality of capturing audio in Phonegap follow the steps given below :

  1. First of all download and install the Xampp Server and gitbash in your machine and if it is already installed go to Xampp -> htdocs folder .
  2. In this htdocs folder create a new folder say Audio .
  3. Create a new text document in this Audio folder and name it as index.html
  4. Now open the index.html file with Notepad++ and write the following code as given below :
  5. Here is the screeshots of the code :
  6. Phonegap1
    CaptureAudio2
    CapturingAudio3
    CapturingAudioinPhonegap4
    Phonegap5

  7. Now just google jquery then you will get the following search options as shown below :
  8. AudioCapture6

  9. Now click on Download jQuery option as shown in the image with an arrow head .
  10. Phonegap7

  11. After clicking you will get the jQuery window which will consists of some compressed jQuery codes , so now click on download the compressed,production jQuery code link as shown below in the image :
  12. 8

  13. After clicking on it you will get the following screen as shown in the image :
  14. 9

  15. Now press ctrl+u and you will get the view-source code of jQuery .
  16. 10

  17. Now create a new folder in audio folder called as js and in this js folder create a new text document as jquery.js , copy and paste the view-source code of jquery in it .
  18. Start your xampp server from xampp control panel .
  19. Now open up your browser and enter the following url localhost/audio and enable your ripple emulator, you will have the following output :
  20. Capturing Audio in Phonegap

  21. Hence after writing the code save your document and now sign in into your Github account by visiting github.com :
  22. 0

  23. So now enter a username ,your email id and password in the respective tabs and click on the Sign up for GitHub button .
  24. After you click on the signup button you will get the following window :
  25. 0.1

  26. Now click on the ‘+’ icon on the right hand side as indicated by the red arrow and then click on the “ New repository ” as indicated by the blue arrow .
  27. 0.2

  28. After clicking on the New repository you will be navigated to the next window ,specify a Repository name ,select a public radio button and click on the Create repository button as shown in the image below :
  29. 0.3

  30. So after clicking on the Create repository button you have the following window :
  31. 0.4

  32. Go to xampp -> htdocs .
  33. In htdocs you have your audio folder created .
  34. Now go to your start menu -> GitBash -> right click on it -> Send To -> Desktop (create a shortcut) of GitBash on Desktop as shown below :
  35. 0.7

  36. So now on Desktop you will have a GitBash icon .
  37. Now Right Click on the GitBash icon on the desktop and go to properties and in the Start in edit box set the path as : c:xampphtdocs as shown in the image.
  38. 0.8

  39. Now Click on Apply and OK button .
  40. Now start the GitBash application from the desktop and you will have the following screen :
  41. 0.9

  42. Now insert the following command as shown below in the gitbash command prompt window..
  43. Thus after inserting the commands you will have the following view of your window :
  44. 0.10

  45. After you get this , insert further commands in the same command prompt window as given below :
  46. After inserting this command your gitbash command prompt window will have the following look , check whether your username and email you entered has been generated in the list :
  47. 0.11

  48. After this insert the following commands :
  49. You will have the following window :
  50. 0.12

  51. Now go to your github account where you had created the audio repository and copy the add origin command and push command and paste it in the gitbash command prompt respectively.
  52. 0.13

  53. So after adding the commands you will be asked for your github username and password ,so you will have the following window :
  54. 0.14

  55. Thus now the push operation is complete, so now we are ready to build our application .
  56. Now go to www.build.phonegap.com and click on Sign in tab present at the right.
  57. 1

  58. After clicking on the Sign in button you will get the next page where you have to click on the Sign in with GitHub button as shown by the arrow head ..
  59. 2

  60. After that you will be navigated to the next page where you have to click on the new app button as shown by the red arrow head.
  61. 3

  62. After clicking on the new app button ,you will get the following window where you have to select the open-source tab and click on the dropdown pointer and select your app as shown in the image :
  63. 4

    NOTE : Here you will have your own application name that is the name given by you while creating the repository.

  64. When you select your app the fetching process will start as shown in the figure :
  65. 5

  66. After the fetching is complete you will get the following window :
  67. 6

  68. Now click on the Ready to Build button as shown by the red arrow in the image and you will get the following screen :
  69. 7

  70. Click on the android icon and you will have the following window popping up to save the apk file.
  71. 8

  72. Now save your apk file and insert it in your android mobile phone and install it ,you will have the application running on your mobile phone

LEAVE A REPLY

Please enter your comment!
Please enter your name here