# Error with worker.getUserMedia in mediasoup-client-aiortc

**URL:** <https://mediasoup.discourse.group/t/error-with-worker-getusermedia-in-mediasoup-client-aiortc/2322>\
**Category:** mediasoup libraries\
**Created:** [January 26, 2021, 8:02am UTC](https://mediasoup.discourse.group/t/error-with-worker-getusermedia-in-mediasoup-client-aiortc/2322 "2021-01-26T08:02:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivorhoulker](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ivorhoulker/32/778_2.png) [@ivorhoulker](https://mediasoup.discourse.group/u/ivorhoulker)\
**Post date:** [January 26, 2021, 8:02am UTC](https://mediasoup.discourse.group/t/error-with-worker-getusermedia-in-mediasoup-client-aiortc/2322/1 "2021-01-26T08:02:43Z")

</div>

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.

```auto
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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![ivorhoulker](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/ivorhoulker/32/778_2.png) [@ivorhoulker](https://mediasoup.discourse.group/u/ivorhoulker)\
**Post date:** [January 26, 2021, 8:36am UTC](https://mediasoup.discourse.group/t/error-with-worker-getusermedia-in-mediasoup-client-aiortc/2322/2 "2021-01-26T08:36:54Z")

</div>

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