> For the complete documentation index, see [llms.txt](https://posetracker.gitbook.io/posetracker-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://posetracker.gitbook.io/posetracker-api/use-posetracker-on-real-time-camera-webcam/tracking-endpoint-message-to-handle/initialization.md).

# Initialization

type: 'initialization',

Data composition for `type: 'initialization'`

```json
{
  "type": "initialization",
  "message": "accessing webcam",
  "ready": false
}
```

These messages show load progress and the ready state.

For runtime fallback warnings, see [Tracking Endpoint Message to handle](/posetracker-api/use-posetracker-on-real-time-camera-webcam/tracking-endpoint-message-to-handle.md).

### Slow devices & long model load

A long `ready: false` period is normal.

This is common on first launch and slower devices.

Do not treat it as a failure by itself.

#### Real-time webcam

Use this order for camera-based tracking:

| Order | Payload                                                                         | Meaning                           |
| ----- | ------------------------------------------------------------------------------- | --------------------------------- |
| 1     | `{ "type": "initialization", "message": "checking you plan and access" }`       | Token and access check            |
| 2     | `{ "type": "initialization", "message": "accessing webcam" }`                   | Camera permission and startup     |
| 3     | `{ "type": "initialization", "message": "loading pose model", "ready": false }` | Model download and initialization |
| 4     | `{ "type": "initialization", "message": "running", "ready": true }`             | Tracking is live                  |

Use `message: "running"` with `ready: true` as the ready signal.

```json
{
  "type": "initialization",
  "message": "running",
  "ready": true
}
```

If the device falls back to a slower backend, you may also receive performance warnings on the [Tracking Endpoint Message to handle](/posetracker-api/use-posetracker-on-real-time-camera-webcam/tracking-endpoint-message-to-handle.md) page.

#### Upload video

Use this order for `source=video`:

| Order | Payload                                                                                                              | Meaning                     |
| ----- | -------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| 1     | `{ "type": "initialization", "message": "loading video" }`                                                           | Video element is loading    |
| 2     | `{ "type": "initialization", "message": "Your video is processing, please stay on this page (N%)", "ready": false }` | Offline analysis is running |
| 3     | `{ "type": "initialization", "message": "Analysis completed", "ready": true }`                                       | Analysis finished           |

This flow does not use `message: "initializing pose model"`.

Example progress payload:

```json
{
  "type": "initialization",
  "message": "Your video is processing, please stay on this page (42%)",
  "ready": false
}
```

If the detector cannot start, the page sends an `initialization` message, not an `error`:

```json
{
  "type": "initialization",
  "message": "Unable to initialize pose detector for offline analysis.",
  "ready": false
}
```

#### Upload image

Use this order for `source=image`:

| Order | Payload                                                                              |
| ----- | ------------------------------------------------------------------------------------ |
| 1     | `{ "type": "initialization", "message": "loading image" }`                           |
| 2     | `{ "type": "initialization", "message": "initializing pose model", "ready": false }` |
| 3     | `{ "type": "initialization", "message": "running", "ready": true }`                  |

Example ready payload:

```json
{
  "type": "initialization",
  "message": "running",
  "ready": true
}
```

If the model fails to load, the page sends:

```json
{
  "type": "error",
  "message": "Pose model failed to load."
}
```
