Can I use javascript to record voice on a web app?
Asked Answered
K

4

18

It seems I can only use Flash or Java to record voice on a web app. Is there a way of doing it via JavaScript?

Kyungkyushu answered 26/2, 2013 at 6:22 Comment(2)
#12149951Willful
Possible duplicate of How can I record a user's voice using Javascript/PHP?Infinity
I
17

It can be done but the solution won't work across all platforms at the moment.

<input type="file" accept="audio/*;capture=microphone">

See HTML5 Media Capture

Currently Supported By:

Android 3.0 browser, Chrome for Android (0.16), Firefox Mobile 10.0, iOS6 Safari and Chrome (partial support)

Links:

http://www.html5rocks.com/en/tutorials/getusermedia/intro/

Audio capturing with HTML5

Installation answered 26/2, 2013 at 6:26 Comment(2)
iOS (all versions up to 9) does not support recording only audio through HTML5 Media Capture. Safari on iOS will bring up the photo/video recording app.Rescission
Some great screenshots with HTML Media Capture in Safari on iOS9 addpipe.com/blog/…Rescission
B
4

Javascript cannot access your hardware directly. What you need, is a client side technology that can. Flash, for one.

Javascript can communicate quite easily with flash, so you can hide your flash recorder and construct your recorder ui with html/js/css.

Here's one example: https://github.com/jwagener/recorder.js/blob/master/examples/example-1.html

Here's another one: http://blogupstairs.com/flashwavrecorder-javascript-flash-audio-recorder/

I realize this is not EXACTLY what you need, but you didn't tell why you want a JS solution. This doesn't fix the flash dependency problem but it solves the UI problem since you can construct the UI without flash.

Blanchette answered 26/2, 2013 at 6:42 Comment(0)
P
1

Another wellknow solution is WAMI, I know it's not pure javascript but maybe it can help.

"As of this writing, most browsers still do not support WebRTC's getUserMedia(), which promises to give web developers microphone access via Javascript. This project achieves the next best thing for browsers that support Flash. Using the WAMI recorder, you can collect audio on your server without installing any proprietary media server software." https://code.google.com/p/wami-recorder/

Another example using node.js This example application is written in JavaScript and uses Node and Express for the web server and framework. You will need all three installed on your web server in order for this to work, as well as the Node.js WebAPI Library. nodejs voice recording example

Phyl answered 31/10, 2013 at 2:55 Comment(0)
R
1

Yes there is a pure HTML/JavaScript way but it only works in Firefox and Chrome: http://audior.ec/blog/recording-mp3-using-only-html5-and-javascript-recordmp3-js/

Direct demo: http://audior.ec/recordmp3js/

Rescission answered 2/10, 2015 at 13:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.