Error with worker.getUserMedia in mediasoup-client-aiortc

I’ve got mediasoup server and browser client working well, but I’m trying to create a node client to broadcast from.

I’m sure I have python set up correctly, but after creating the worker successfully, attempting to create any kind of stream with worker.getUserMedia fails. I’m trying this on a mac at the moment.

const worker = await createWorker({
            logLevel: 'warn',
console.log("worker", worker)
const stream = await worker.getUserMedia({
            video: true,

I can log the worker and it looks normal, but I get the following error when it tries to get the stream:

InvalidStateError: Channel closed
    at Object.close (.../mediasoup-client-aiortc/lib/Channel.js:150:29)
    at Channel.close (.../mediasoup-client-aiortc/lib/Channel.js:90:18)
    at Worker.close (.../mediasoup-client-aiortc/lib/Worker.js:167:23)
    at ChildProcess.<anonymous> (.../mediasoup-client-aiortc/lib/Worker.js:80:18)
    at ChildProcess.emit (events.js:314:20)
    at ChildProcess.EventEmitter.emit (domain.js:486:12)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)

I expect it’s something basic like permissions/devices on mac, and will try Linux when I can, but I’m not sure how to proceed from here at the moment - would be grateful for any advice.

Just accidentally solved this, hope it helps someone else if they come across the same error:

Originally I was trying to run it from the terminal in vscode. It works now by running it from the regular terminal after running ffmpeg in the command line to record a video stream, which prompts you to give permissions for terminal to access mic/webcam (can probably also do that manually if you realise you have to give permissions to terminal).