> 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

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

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

Underlying error raised by the WebRTC stack.

## **Properties**

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

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

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);
  }
});
```