How to record audio in a Chrome Extension?

2019-06-20 01:08发布

问题:

What's the simplest way to setup a chrome extension to record audio from the microphone?

  • I see there is a working experimental speech input API but how come you don't have access to the recorded file? Seems like hooking up into that should be simple enough, as it's a step earlier in the process, no? Especially as there is also a text-to-speech API, so you could effectively record into text and then have the computer speak it back out, but unless you want a standard voice, how lame, redundant and prone to error is that?

  • Then there seem to be flash solutions like this but how can I use that in a chrome extension without having to setup anything server-side? (since I don't actually need to send anything to a server--it's all local and client-side)

  • Is NPAPI a possibility? Is there such a plugin ready-made?

Don't know of other possible alternatives (HTML5 isn't ready yet, it seems) but I welcome anything functional and simple to implement and hook into a chrome extension.

回答1:

Finally a native solution appeared: Introducing getUserMedia



回答2:

You cannot use the speech input API, since it will record only the microphone. Okay, you can grab the speakers like that, but it's clearly not the solution. Using a NPAPI plugin is a solution. You'll can identify the sound made by a particular tab and after record that source, but it is no longer web dev.