How to use microphone with Firefox?

aragats

Daemon

Reaction score: 642
Messages: 1,550

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?
 
OP
aragats

aragats

Daemon

Reaction score: 642
Messages: 1,550

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:
mic.png
I have no problem with recording video/audio using e.g. multimedia/ffmpeg, it's namely a Firefox issue.
 

vall

Member

Reaction score: 5
Messages: 50

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

Member

Reaction score: 17
Messages: 33

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@

Daemon
Developer

Reaction score: 487
Messages: 1,215

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?
 

Alain De Vos

Aspiring Daemon

Reaction score: 211
Messages: 768

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

aragats

Daemon

Reaction score: 642
Messages: 1,550

@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.
 

jrm@

Daemon
Developer

Reaction score: 487
Messages: 1,215

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

Code:
% 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

Member

Reaction score: 56
Messages: 60

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

Code:
% 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.
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@

Daemon
Developer

Reaction score: 487
Messages: 1,215

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

Active Member

Reaction score: 170
Messages: 190

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.
 

cederom

Member

Reaction score: 5
Messages: 48

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

Member

Reaction score: 10
Messages: 71

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).


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". :D
 
Top