# API Reference

## PixelStreamComponent Props (React)

| Prop                          | Type              | Required | Description                                                                  |
| ----------------------------- | ----------------- | -------- | ---------------------------------------------------------------------------- |
| `expId`                       | `string`          | ✅ Yes    | The unique experience ID for the experience you want to load.                |
| `InitialScreen`               | `React.ReactNode` | ❌ No     | Optional custom loading screen component shown before the stream loads.      |
| `serviceUrls`                 | `object`          | ❌ No     | Override default service endpoints (useful for on-premise or custom setups). |
| `serviceUrls.sessionFetch`    | `string`          | ❌ No     | Custom URL for fetching session data.                                        |
| `serviceUrls.pixelStreamBase` | `string`          | ❌ No     | Custom base URL for connecting to the Pixel Streaming server.                |

***

## PixelStreamComponentHandles Methods (React)

These methods are exposed via the `ref` to the component:

| Method                    | Description                                |
| ------------------------- | ------------------------------------------ |
| `enableCamera()`          | Enables the user's webcam.                 |
| `disableCamera()`         | Disables the user's webcam.                |
| `enableCharacterAudio()`  | Unmutes audio coming from the character.   |
| `disableCharacterAudio()` | Mutes the character audio.                 |
| `initializeExperience()`  | Starts the experience if not auto-started. |

***

## PixelStreamClient Options (Vanilla / TS / CDN)

| Option                        | Type          | Required | Description                                                                  |
| ----------------------------- | ------------- | -------- | ---------------------------------------------------------------------------- |
| `container`                   | `HTMLElement` | ✅ Yes    | DOM element where the pixel stream will be mounted.                          |
| `expId`                       | `string`      | ✅ Yes    | The experience ID to load the experience.                                    |
| `InitialScreen`               | `HTMLElement` | ❌ No     | Optional loading screen shown while the experience initializes.              |
| `serviceUrls`                 | `object`      | ❌ No     | Object to override default endpoints (for on-premise or custom backend use). |
| `serviceUrls.sessionFetch`    | `string`      | ❌ No     | Custom endpoint for session fetch API.                                       |
| `serviceUrls.pixelStreamBase` | `string`      | ❌ No     | Base URL of the Pixel Streaming backend server.                              |

***

## PixelStreamClient Methods

These are available on the `pixelStream` instance in Vanilla/TS/CDN setups:

| Method                    | Description                                    |
| ------------------------- | ---------------------------------------------- |
| `enableCamera()`          | Enables the user’s webcam. Returns a Promise.  |
| `disableCamera()`         | Disables the user’s webcam. Returns a Promise. |
| `enableCharacterAudio()`  | Enables character audio output.                |
| `disableCharacterAudio()` | Disables character audio output.               |
| `initializeExperience()`  | Starts the experience manually.                |
| `destroy()`               | Cleans up the stream and DOM elements.         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/plugins-and-integrations/convai-pixel-streaming-embed/api-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
