# How to use microphone with Firefox?



## aragats (Mar 1, 2020)

It doesn't work with both plain OSS and audio/sndio, i.e. Firefox asks for permission to use it on the corresponding web sites (like FB Messenger), then shows a mic's icon that it's in use, but it doesn't actually work. It works in Chromium. What am I missing?


----------



## Lamia (Mar 1, 2020)

Would you want to try an extension in Firefox maybe some changes need to be made in the config?









						Video Recorder – Get this Extension for 🦊 Firefox (en-US)
					

Download Video Recorder for Firefox. Easily record video & audio from your computer's camera




					addons.mozilla.org


----------



## aragats (Mar 1, 2020)

Lamia said:


> to try an extension in Firefox maybe some changes need to be made in the config


Thanks, but it cannot help in any way, doesn't have any settings to configure too, it takes whatever Firefox provides.
The problem is that Firefox cannot deal with microphone for unknown reason. It shows only "default" option:


I have no problem with recording video/audio using e.g. multimedia/ffmpeg, it's namely a Firefox issue.


----------



## vall (Mar 5, 2020)

For me the solution was to just install audio/pulseaudio, then run
`pulseaudio --start`
Then run Firefox and try to record.
Request for allowing of record will now show /dev/dsp devices and mic should work.
Tested yesterday.


----------



## Shadow53 (Mar 29, 2020)

vall said:


> For me the solution was to just install audio/pulseaudio, then run
> `pulseaudio --start`
> Then run Firefox and try to record.
> Request for allowing of record will now show /dev/dsp devices and mic should work.
> Tested yesterday.



While this works, it really just sidesteps the issue that it doesn't work with OSS or Sndio. I'm having a similar issue with a Firefox built with Sndio support and not ALSA or Pulseaudio. Firefox should support the microphone as long as FreeBSD does, but I think (some of) the issue is getting Sndio set up with the audio devices correctly.


----------



## jrm@ (Apr 18, 2020)

It would  be nice if this worked in Firefox (or Chrome) with sndio.  It does work for me when I configure www/firefox with the PULSEAUDIO knob, but then audio is crackly.  Has anyone come across this and have a solution?


----------



## 20-100-2fe (Apr 18, 2020)

Have you tried to set media.cubeb.backend=sndio in about:config?


----------



## jrm@ (Apr 19, 2020)

Using sndio does fix the audio crackling problem, but then the microphone is not detected.  When using pulseaudio, the micriphone (/dev/dsp) is detected, but the crackling returns.

aragats I am curious how you got the microphone to work with www/chromium.  Others also are having problems with microphone detection in Chromium.


----------



## Alain De Vos (Apr 19, 2020)

Somewhere i read for firefox , about:config , media.cubeb.sandbox false.
Can you tune the samplerate for pulseaudio ?


----------



## aragats (Apr 19, 2020)

jrm@ said:


> @aragats I am curious how you got the microphone to work with www/chromium.


It is working in Chromium without any manual intervention. Although I'm using packages, I checked the port and found by default it's compiled with ALSA.


----------



## Alain De Vos (Apr 19, 2020)

PS : I have the microphone also working with chromium but fail with firefox.


----------



## jrm@ (Apr 19, 2020)

After rebuilding www/chromium with default options the mic is still not detected.


```
% pkg info chromium-81.0.4044.113
chromium-81.0.4044.113
Name           : chromium
Version        : 81.0.4044.113
Installed on   : Sun Apr 19 16:03:10 2020 ADT
Origin         : www/chromium
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : java www
Licenses       : BSD3CLAUSE, LGPL21, MPL11
Maintainer     : chromium@FreeBSD.org
WWW            : https://www.chromium.org/Home
Comment        : Google web browser based on WebKit
Options        :
        ALSA           : on
        CODECS         : on
        CUPS           : on
        DEBUG          : off
        DRIVER         : on
        KERBEROS       : on
        PULSEAUDIO     : off
        SNDIO          : off
        TEST           : off
```
.

I also rebuilt any audio dependencies with default options (mostly turning off sndio), but the result is the same.

I also played with the sampling rate in pulseaudio, (up to 96000 and down to 22000), but the crackling in firefox got worse, especially at 96000.


----------



## patovm04 (Apr 20, 2020)

jrm@ said:


> After rebuilding www/chromium with default options the mic is still not detected.
> 
> 
> ```
> ...


Could it have something to do with having pulseaudio installed? I don't have it installed, and Chromium from packages (81.0.4044.113) doesn't have any troubles with detecting my microphone


----------



## jrm@ (Apr 20, 2020)

patovm04 said:


> Could it have something to do with having pulseaudio installed? I don't have it installed, and Chromium from packages (81.0.4044.113) doesn't have any troubles with detecting my microphone



Uninstalling pulseaudio made no difference.  Could you elaborate on how it is detected for you?  At https://mictests.com/ it is also detected for me, but clicking the "Test my mic" button reports an error. When trying services like https://meet.jit.si the mic does not work (in Chromium).

P.S. I'm afraid I have contributed to sending this thread off topic, since it was originally about Firefox.  I will ask the mods to do some cleaning up.  It might make sense to move the posts about Chromium to a more appropriate thread.


----------



## memreflect (May 14, 2020)

aragats said:


> It doesn't work with both plain OSS and audio/sndio, i.e. Firefox asks for permission to use it on the corresponding web sites (like FB Messenger), then shows a mic's icon that it's in use, but it doesn't actually work. It works in Chromium. What am I missing?


I had to start/onestart sndiod(8) after installing audio/sndio to get it working, and you can't select which mic to use.  Personally, I only use a single mic, so I honestly don't mind sndio, especially since it requires fewer dependencies than PulseAudio.  To be fair, however, PulseAudio itself did build relatively quickly, and there's little left to do other than choosing your mic when Firefox requests it.  I do agree with jrm@ that the audio crackling is a problem that disappears with sndio.


----------



## Čertik (Dec 2, 2020)

*FIXED*
I'll just send a mail to correct this mail to correct. Simply set/add this lines in about:config :

```
media.cubeb.backend                             oss
media.cubeb.input_voice_routing                 true
media.cubeb.output_voice_routing                true
```

>> The correction must be added in the port www/firefox  and www/firefox-esr at /usr/ports/www/firefox/files/patch-addon-search but I have'nt got the time right now


----------



## cederom (Jan 23, 2021)

I can confirm that `media.cubeb.backend=oss` in `about:config` brings back the microphone to Firefox! Thank you!

In addition `media.cubeb.output_voice_routing=true` and `media.cubeb.input_voice_route=true` allows playback with only selected device, otherwise I got playback on all available audio outputs (i.e. internal speakers, external usb card loudspeakers, external usb headphones) 

Obviously PulseAudio got broken with a recent release because it worked not that long ago :-(

Update: Rebuilding and reinstalling PulseAudio (13.0_2) from ports fixed microphone problems for me both in Firefox and Chromium  I am using Enlightenment WM that uses PulseAudio as its sound backend and it has pretty nice mixer utility, but I saw XFCE4 also has very nice mixer utility working with PulseAudio. PulseAudio backend support was added to Chromium on my request. So I have microphone and audio output in both Firefox and Chromium that I use mainly for videoconferencing (camera works using `webcamd`). This OSS trick however seems to be a very nice fallback. Thank you


----------



## mzs47 (Jan 24, 2021)

One thing I noticed is certain sites lists multiple input options with www/firefox-esr, for instance the below ones(I used ESR version with a USB headset).









						Jitsi Meet
					

Join a WebRTC video conference powered by the Jitsi Videobridge




					meet.jit.si
				








						Online mic test and playback
					

Mic test lets you quickly test your microphone (mic) allowing audio recording and playback. Fastest mic tester on the internet. All recordings stay on your computer so your privacy is 100% safeguarded




					mic-test.com
				




Similar to observations of cederom, the recent Enlightenment in ports has improved a lot and I was pleasantly surprised to see audio mixer option, this was not the case before.

As the PC has multiple devices, I had to use `sysctl hw.snd.default_unit=(device id from /dev/sndstat)`, next as the recordings were sounding feeble, so I had to use the command `mixer mic 100` to get a decent gain.


Also, if it helps anyone, I was able to use Google hangouts from both Chromium and Firefox-ESR and even net-im/telegram-desktop. Calling to Canadian and US numbers is free from this. 
Now just need Slack/Zoom working(without the Linux layer) and I can finally start using FreeBSD at work to manage "cloud".


----------

