jRecorder – jQuery plugin for audio recording

Recently I made a jQuery plugin named jRecorder to record voice in html pages.

This plugin is very easy to integrate with your web page and you DON’T need a flash server or RED5 server to do the recording

What all you need is a Web Server (PHP or any server scripting language).

You can find the documentation and Download the plugin HERE.

eg: $.jRecorder( settings );

Another advantage is your can decide your recorder design, buttons , mic activity level , recording progress etc in HTML+CSS and this plugin gives you many recording callback events to manage. It is like jPlayer plugin for audio playback.

JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$.jRecorder ({
'rec_width': '300',
'rec_height': '200',
'rec_top': '0px',
'rec_left': '0px',
'recorderlayout_id' : 'flashrecarea',
'recorder_id' : 'audiorecorder',
'recorder_name': 'audiorecorder',
'wmode' : 'transparent',
'bgcolor': '#ff0000',
'swf_path': 'jRecorder.swf',
'host': 'acceptfile.php?filename=hello.wav',
'callback_started_recording' : function(){},
'callback_finished_recording' : function(){},
'callback_stopped_recording': function(){},
'callback_error_recording' : function(){},
'callback_activityTime': function(time){},
'callback_activityLevel' : function(level){}
});

This plugin sends recorded WAV file to your webserver, where you can save this file where ever you wish. You can use FFMPEG tool to convert this WAV to MP3 or any other format for further use

The technology used here is, the plugin uses hidden swf file to record the voice and save the binary data in browser’s cache and when the recording finishes, it sends the data to webserver. Thats why you don’t need any Flash media server to capture the recording on time.

The plugin is good for recording voice less than 180 seconds (3 min), else the time to upload the final data to server takes longer.

Feel free to add comments here if the plugin causes any problem or error.

Those who wish to continue the development, the GIT version is available at: https://github.com/sythoos/jRecorder/

Thanks

Sajith

 

54 Comments

54 Responses to “jRecorder – jQuery plugin for audio recording”

  1. fapprika November 11, 2011 at 5:05 am #

    Hi,

    That is the most useful plugin we’ve ever seen. But there is a problem with it. We think the problem is in the swf file (because we cannot find the crossdomain.xml string anywhere in html or js files.) It tries to find “http://yourhost.com or localhost/crossdomain.xml” and cannot find it anywhere (normally). Can you fix it?

    Thanks.

    • Mr Me November 12, 2011 at 11:56 pm #

      Why do you need the crossdomain.xml file, it is not needed to implement this recorder. Did you see the example I provided ?

  2. Pedro Abreu November 14, 2011 at 1:59 am #

    hi, your plugin is great, just what i’m looking for…

    I have tried it and there’s a problem im the saved wave file. When you listen the wave file she’s running too faster…

    How can i chenge this? thanks

  3. aarp November 15, 2011 at 3:22 am #

    Hi! Is it possible to add “Replay” option to it? I would like hear it before I upload it.

    • Mr Me November 18, 2011 at 12:04 am #

      I will update the plugin with re-play option soon.

  4. mischa November 25, 2011 at 3:10 pm #

    looks cool. would it be possible to record in higher resolution? 16bit/44khz but only for 10 seconds.

  5. laurence November 26, 2011 at 7:34 am #

    Error: getFlashMovie(jRecorderSettings.recorder_name).jStartRecording is not a function
    Source File: file:///C:/xampp/htdocs/jRecorder/jRecorder.js
    Line: 166

    why is that i got this error please help….

    • Yohan December 3, 2011 at 9:46 pm #

      You’re not correctly set the path to jRecorder.swf file.

  6. laurence November 28, 2011 at 6:38 am #

    where can i find this function???

    jStartRecording(max_time);

    please help me please i really need this one…. this is not working anymore.. i don’t know why..
    even this example is not working..

    http://www.sajithmr.me/jrecorder/example1.html

    • Mr Me November 28, 2011 at 3:06 pm #

      This is because

      jRecorder.swf

      is not in the path.

      In the whole settings

      var settings = {

      ‘rec_width’: ’300′,
      ‘rec_height’: ’200′,
      ‘rec_top’: ’0px’,
      ‘rec_left’: ’0px’,
      ‘recorderlayout_id’ : ‘flashrecarea’,
      ‘recorder_id’ : ‘audiorecorder’,
      ‘recorder_name’: ‘audiorecorder’,
      ‘wmode’ : ‘transparent’,
      ‘bgcolor’: ‘#ff0000′,
      ‘swf_path’: ‘jRecorder.swf’,
      ‘host’: ‘acceptfile.php?filename=hello.wav’,
      ‘callback_started_recording’ : function(){},
      ‘callback_finished_recording’ : function(){},
      ‘callback_stopped_recording’: function(){},
      ‘callback_error_recording’ : function(){},
      ‘callback_activityTime’: function(time){},
      ‘callback_activityLevel’ : function(level){}
      };

      You can place your related path for jRecorder.swf. Make sure this is on the right place.

      Also try updating your flash plugin in your browser

      • laurence November 29, 2011 at 5:44 pm #

        how can we create higher quality audio?

  7. mischa November 28, 2011 at 4:24 pm #

    looks cool. would it be possible to record in higher resolution? 16bit/44khz but only for 10 seconds

  8. bastien November 29, 2011 at 8:27 pm #

    Hi! Nice work!

    But it doesn’t work on any browsers, in fact only chrome for me… The flash pop up doesn’t work. I can’t clic on its buttons. What’s the matter?

    Regards,
    Bastien

  9. laurence December 2, 2011 at 1:17 pm #

    hey, i have noticed that sometimes the plugin is not working.. do you have idea why its like that?
    sometimes its working but sometimes its not working..

    • laurence December 5, 2011 at 7:01 am #

      have you tried the plugins? this is not working.. what is the problem?

  10. Eric December 8, 2011 at 10:55 am #

    Awesome tool!

    As a previous user mentioned, a replay option would be great.

    Thank you very much, great work.

    • Mr Me December 9, 2011 at 10:04 pm #

      It will be available very soon, I am on it

      • Eric December 10, 2011 at 2:17 pm #

        Thanks again! Making this public is very kind.

  11. anton December 9, 2011 at 1:31 am #

    Nice plugin, mr me!
    any ideas on when you’ll be able to add playback/re-play functionality?

  12. Mr Me December 14, 2011 at 7:48 pm #

    IF anybody wish to continue the development on this, GIT version is made public at https://github.com/sythoos/jRecorder/

  13. Mr Me December 14, 2011 at 10:31 pm #

    jRecorder with Preview option is implemented:

    http://www.sajithmr.me/jrecorder/

    • Eric January 4, 2012 at 9:29 am #

      Thank you!

  14. Abdul December 18, 2011 at 8:43 pm #

    Hi Sajith,

    Really a great job.
    Thanks too for make this plugin as public..

  15. Xeq3 December 25, 2011 at 3:11 am #

    Is it possible to turn off the automatic playback? also any thought on how to get this to work IE

    • Matheus Moreira January 17, 2012 at 2:24 am #

      anyone knows how to work in IE?

  16. MasterMind December 25, 2011 at 10:26 pm #

    Hi Sajith,

    I really want to thank you for this plugin, I was just about to start developing something like that, you saved my time :)

    I want to know, what is the license of this plugin? can I use the plugin in my commercial projects?

    Thanks in advance.

    • Mr Me December 30, 2011 at 4:13 pm #

      you can use this for any commercial projects.

  17. rongchao January 9, 2012 at 1:31 am #

    HI Mr me:
    I download the zip, and run example1.html, but recording does not work.
    I am sure my chrome browser is ok, because I run example in your website quite well
    Does ‘swf_path’: ‘jRecorder.swf’ mean example1.html and jRecorder.swf in the save directory?

  18. AJ January 11, 2012 at 9:03 am #

    Thanks for the awesome plugin ! My only question is whether it’s possible to disable the ‘stop’ command from previewing the recorded audio automatically ? For some reason – as soon as I hit the stop button, it starts playing the audio that was recorded. I looked at the actionscript Main.as code and it looks like you have it in there. I’m guessing I’d have to recompile the SWF if I wanted to make that fix myself ?

    • Mr Me January 18, 2012 at 2:48 pm #

      Yes, you want to edit AS file to disable automatic audio playback.

  19. Lin Kasagi January 11, 2012 at 10:30 am #

    How to get Jrecorder to work for other browsers other than chrome…

  20. James January 12, 2012 at 9:52 pm #

    Do you have instructions on how to compile the actionscript?
    Hoping that this can be done using the open source flex sdk mxmlc…

  21. vineeth January 16, 2012 at 8:15 pm #

    it is working well in chrome but is not working in opera and ie browsers. could you please help me out??

  22. dev January 27, 2012 at 9:09 pm #

    Hello, great script, however as others state – It does not work in IE, or firefox. Here is the error –
    [11:06:35.242] getFlashMovie(jRecorderSettings.recorder_name).jStartRecording is not a function @
    jRecorder.js:163 is there a fix??

  23. Ali February 4, 2012 at 4:54 pm #

    Hi,
    my friend i can`t run your script in my website.
    please go to this url and check it.

    http://gemgroup.ir/jRecorder/jRecorder/example1.html

    it can`t record any voice, level: -1.
    please help me.

    Thanks

    • ali February 12, 2012 at 6:25 pm #

      Mr Me please help me

  24. Arif Ceylan February 11, 2012 at 11:53 pm #

    it didnt work on ie.
    Error : ‘undefined’ or null object at line 164 in js file…

    getFlashMovie(jRecorderSettings['recorder_name']).jStartRecording(max_time);

    error at this line.

    • Mr Me February 12, 2012 at 2:30 am #

      Remove the trailing comma in the jQuery initialization. In IE, it is causing that error.

  25. Arif Ceylan February 13, 2012 at 1:43 am #

    there is a problem on internet explorer 8.

    http://www.arifceylan.com/error.jpg

  26. laurence February 16, 2012 at 1:57 pm #

    There is an error please check this one.. this is from your example…

    http://s286.photobucket.com/albums/ll110/ljlerit/?action=view&current=Error.png

  27. Mukul February 16, 2012 at 5:24 pm #

    Not working.. don’t know why… In your example its working perfectly but on client side ask to execute flash and then nothing is happening on clicking Record button..!! Help..!!

    • Mr Me February 16, 2012 at 8:39 pm #

      Use Firebug in Firefox and check for any script error, either the path of swf file or javascript may be missing. Paste your site link here, i can have a look.

  28. Mukul February 16, 2012 at 8:46 pm #

    Thanks for response.. !! Will try to check error… recently it is on the link http:// visjaipur . org/jRecorder/example1.html

    • Mr Me February 16, 2012 at 9:50 pm #

      Your problem is jQuery is missing. You need to place jquery.min.js in your server path, that file seems empty now : visjaipur.org/jRecorder/jquery.min.js

  29. ali February 17, 2012 at 1:13 am #

    to use replay simply repeat this code

    $(‘#replay’).click(function(){

    $.jRecorder.stop();

    })
    Replay

  30. Mukul February 17, 2012 at 9:03 am #

    Thanks… a lot.. Actually there was a problem in uploading the files… now working perfectly..!! on another link : http: //services.creativemukul. com/example1.html

  31. Ali February 17, 2012 at 12:24 pm #

    i get this error in your example1

    NetworkError: 404 Not Found – http://yourdomain.com/crossdomain.xml

    this error returned by firebug

  32. Mukul February 18, 2012 at 3:39 pm #

    Hello Sir, Is it possible to use this in asp.net.. if it is then what to do with server path… it’s not actually receiving any audio file.. at the given path…

Trackbacks/Pingbacks

  1. jRecorder1.1 with Preview option is released | Programming Ideas, Logics, Tips and Tricks - December 14, 2011

    [...] Two months ago, I published a jQuery plugin to record audio from browser (without any Media server) called jRecorder [...]

Leave a Reply

More in php source code (4 of 31 articles)


In PHP coding, we spend most of the time for debugging. Either we use echo, print_r or var_dump to ...