Trouble with getUserMedia in mediasoup-client-aiortc

I’ve tried a lot of to know what this bug but finally i cannot fix that.
I wanna get getUserMedia by using mediasoup-client-aiortc but got error: ValueError: no container format ‘alsa’.
I’ve already install alsa
Can someone help me?

lamhung@lamhung:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

import { createWorker } from 'mediasoup-client-aiortc';

let wk;
let stream;

(async () => {
    wk = await createWorker({
        logLevel: 'warn',
    });
    stream = await wk.getUserMedia(
        {
            audio : { source: 'device' }
        });
})();
(python_venv) lamhung@lamhung:~/VScode/mediasoup$ PYTHON=/home/lamhung/VScode/mediasoup/producer/python_venv/bin/python3 node tmp.js
/home/lamhung/VScode/mediasoup/node_modules/mediasoup-client-aiortc/lib/Channel.js:229
                        sent.reject(new Error(msg.reason));
                                    ^

Error: ValueError: no container format 'alsa'
    at Channel.processMessage (/home/lamhung/VScode/mediasoup/node_modules/mediasoup-client-aiortc/lib/Channel.js:229:37)
    at Socket.<anonymous> (/home/lamhung/VScode/mediasoup/node_modules/mediasoup-client-aiortc/lib/Channel.js:95:26)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)

Node.js v20.18.0

Hello.

I encounter same issue. In my case, I use webcam and mediasoup-client-aiortc. I can’t fix directly but I solve issue by useing HLS server.

I make simple HLS server using gstreamer like this.

const gst = spawn('gst-launch-1.0', [
  '-e',
  'v4l2src', 'device=/dev/video0',
  '!', 'image/jpeg,width=640,height=360,framerate=15/1',
  '!', 'jpegdec',
  '!', 'videoconvert',
  '!', 'x264enc', 'tune=zerolatency', 'speed-preset=ultrafast',
  '!', 'h264parse',
  '!', 'mpegtsmux', 'name=mux',
  'alsasrc', 'device=hw:3,0',
  '!', 'audio/x-raw,rate=44100,channels=2',
  '!', 'voaacenc',
  '!', 'aacparse',
  '!', 'mux.',
  'mux.', '!',
  'hlssink',
  `max-files=5`,
  `playlist-length=5`,
  `target-duration=2`,
  `location=${path.join(HLS_DIR, 'segment_%05d.ts')}`,
  `playlist-location=${path.join(HLS_DIR, 'stream.m3u8')}`
]);

When using this HLS Server, I simply use URL at getUserMedia.

const stream = await this.worker.getUserMedia({
        video: { source: "url", url: "http://localhost:8000/hls/stream.m3u8" },
        audio: { source: "url", url: "http://localhost:8000/hls/stream.m3u8" }
        });

I hope this helps you :slight_smile: .