No mic on Mediasoup 2 and latest Firefox

We use Mediasoup 2 for a live classroom environment. Recently we had a teacher on the beta Firefox build unable to get their audio working. I reproduced it locally with Firefox beta and have reproduced it with the v2 Mediasoup demo.

Steps to repro:

  1. git clone GitHub - versatica/mediasoup-demo at e160b4e6d402acdf66e24ce3315b8733b13c2014 (the last v2 demo commit)
  2. Follow instructions to install. I actually couldn’t get this to work on my Mac so I used this Dockerfile:
FROM node:12-buster-slim

RUN apt-get update && apt-get install build-essential python -y

WORKDIR /root/annex/server/
COPY . /root/annex/

RUN npm install
RUN cd ../app && npm install
RUN npm install -g gulp-cli

Then I ran these commands:

docker build -t demo .
docker run --rm -it -p 3000:3000 -p 3001:3001 -v $PWD:/mediasoup node:12-buster-slim bash
node server.js
(in another terminal, bashed into the docker container:) cd ../app && gulp live
  1. Visit localhost:3000 in a browser (I had to fight Firefox/Chrome to get them to ignore custom certs)

Behaviour:
On Chrome, I see the demo and when I allow permissions on my mic I see movement in the right indicator when I speak.
On Firefox 110.0b9 (64-bit) on Windows 11 or or Firefox 110.0 on Mac OS 13.2 (ARM), I get no mic movement.
In the console I see these errors:

WARNING! Invalid setParameters call detected! The good news? Firefox supports sendEncodings in addTransceiver now, so we ask that you switch over to using the parameters code you use for other browsers. Thank you for your patience and support. The specific error was: Cannot change transaction id: call getParameters, modify the result, and then call setParameters (Firefox65.js:237)
mediasoup-client:ERROR:CommandQueue _handleCommand() | command failed [method:addProducer]: DOMException: Cannot set an empty encodings array +0ms (common.js:120)
mediasoup-demo:ERROR:RoomClient _setMicProducer() failed:DOMException: Cannot set an empty encodings array +0ms (common.js:120)
WARNING! Invalid setParameters call detected! The good news? Firefox supports sendEncodings in addTransceiver now, so we ask that you switch over to using the parameters code you use for other browsers. Thank you for your patience and support. The specific error was: Cannot change the number of encodings with setParameters (Firefox65.js:237)

I’m guessing the response will be to upgrade to Mediasoup 3. Which is fair enough. I’m hoping there might be some easy fix otherwise I’ll start the upgrade process. And if that’s the case then hopefully Google will pick up this topic because there are no hits for some of the errors above so far.

Sorry it’s not working! I’m trying to triage whether this is a problem with microphone access or a peer connection problem. When you say “movement in the right indicator when I speak”, is this locally (in the browser accessing the microphone) or remotely (from the other participant’s tab)?

Since there’s a macOS difference, could it be OS permission related? E.g. does mic work here Async gUM audio stop - JSFiddle - Code Playground ?

Regarding the peer connection warnings: Firefox recently fixed setParameters() to match other browsers and spec, and those warnings are about legacy behavior that only works in Firefox, and should only be warnings at this point, and not alter any behavior (yet).

Some more testing reveal an error displayed in the UI when connecting to a remote peer: InvalidModificationError..Cannot set an empty encodings array

We are tracking a potential mitigation in 1816160 - web-compat problems with setParameters({encodings: []}).

Thanks for the response!

To clarify, we see the same behaviour on Mac and Windows (just tested on slightly different FF versions). The indicator is the local one.

Really appreciate the attention. Happy to offer further information or fix verification.