Posted By

parkerkrhoyt on 11/04/11


Tagged

phone mobile audio record media device phonegap gap


Versions (?)

Record Audio with PhoneGap


 / Published in: JavaScript
 

  1. $( '#record' )
  2. .bind( 'touchstart', function( e ) {
  3. if( media == null )
  4. {
  5. $( this ).attr( 'src', 'assets/record.down.png' );
  6. } else {
  7. $( this ).attr( 'src', 'assets/stop.down.png' );
  8. }
  9. } )
  10. .bind( 'touchend', function( e ) {
  11. $( this ).attr( 'src', 'assets/stop.up.png' );
  12.  
  13. if( media == null )
  14. {
  15. media = new Media( reference, function() {
  16. // alert( 'Got media' );
  17. }, function( err ) {
  18. // alert( 'Problems accessing media' );
  19. } );
  20.  
  21. media.startRecord();
  22. } else {
  23. media.stopRecord();
  24. media.release();
  25. media = null;
  26.  
  27. $( this ).attr( 'src', 'assets/record.up.png' );
  28. }
  29. } );

Report this snippet  

You need to login to post a comment.