> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# MediaTrackError

> Thrown when a media track operation fails.

Raised when a peer-connection track operation fails — most commonly when the SDK tries to `addTrack`, `replaceTrack`, or remove a track during device switching, muting, or screen-share handoff. The `operation` and `kind` properties locate the failure; `originalError` carries the underlying `DOMException` from the WebRTC stack.

## **Extends**

* `Error`

## **Constructors**

### Constructor

```ts
new MediaTrackError(operation, kind, originalError): MediaTrackError
```

### Parameters

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

Track operation that failed (e.g. `addTrack`, `replaceTrack`).

---

**`kind`** `string` — required

Kind of media track involved (`audio` or `video`).

---

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

Underlying error raised by the WebRTC stack.

---

## **Properties**

**`kind`** `string` — required

Kind of media track involved (`audio` or `video`).

---

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

Track operation that failed (e.g. `addTrack`, `replaceTrack`).

---

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

Underlying error raised by the WebRTC stack.

---

## **Examples**

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

call.errors$.subscribe((err) => {
  if (err instanceof MediaTrackError) {
    console.error(`media track ${err.kind} ${err.operation} failed:`, err.originalError);
  }
});
```