> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# MediaAccessError

> Thrown when local media (camera, microphone, or screen capture) cannot be acquired.

Raised when `getUserMedia` or `getDisplayMedia` fails to hand the SDK a local track — a denied permission, a device already held exclusively by another application, or a capture the browser refused.

Non-fatal by default: a screen share or additional-device failure never ends the call, and a main-connection failure degrades to receive-only when the call is set to receive media. `fatal` is `true` only when the call cannot continue — [`fallbackToReceiveOnly`](/docs/browser-sdk/v4/reference/interfaces/media-options) was disabled, or the call has no receive intent to fall back to.

## **Extends**

* `Error`

## **Constructors**

### Constructor

```ts
new MediaAccessError(operation, media, originalError, fatal?): MediaAccessError
```

### Parameters

**`operation`** `string` — required

The SDK operation that failed, e.g. `'acquireLocalMedia'`, `'startScreenShare'`, `'addInputDevice'`.

---

**`media`** `string` — required

The media being acquired: `'audio'`, `'video'`, `'audiovideo'`, or `'screen'`.

---

**`originalError`** `unknown` — required

The raw `getUserMedia`/`getDisplayMedia` error, typically a `DOMException`.

---

**`fatal`** `boolean` — default: false

Whether this failure terminates the call.

---

## **Properties**

**`denied`** `boolean` — required

Read-only. `true` when the underlying failure is a permission denial by the user or by policy — that is, when `originalError.name` is `NotAllowedError`, `SecurityError`, or `PermissionDeniedError`.

---

**`fatal`** `boolean` — required

Whether this failure terminates the call.

---

**`media`** `string` — required

The media being acquired: `'audio'`, `'video'`, `'audiovideo'`, or `'screen'`.

---

**`operation`** `string` — required

The SDK operation that failed.

---

**`originalError`** `unknown` — required

The raw `getUserMedia`/`getDisplayMedia` error.

---

## **Examples**

```ts
import { MediaAccessError } from '@signalwire/js';

call.errors$.subscribe(({ error, leg }) => {
  if (error instanceof MediaAccessError) {
    if (error.denied) {
      showPermissionHelp(error.media);
    } else if (leg === 'screenshare') {
      toast('Screen share failed — the call is still connected.');
    }
  }
});
```

## **See**

* [`CallError`](/docs/browser-sdk/v4/reference/interfaces/call-error) — the envelope this arrives in on `errors$`, carrying `leg` and `legId`.
* [`MediaOptions.fallbackToReceiveOnly`](/docs/browser-sdk/v4/reference/interfaces/media-options) — controls whether a main-connection failure is fatal.