# Stream quality settings

## Overview

Manage and retrieve pixel stream configuration settings to tailor your application's performance.&#x20;

To set custom quality settings, send a message with `type === "set-stream-settings"`, and a `value` property to the desired setting.&#x20;

To retrieve the current configuration, send a message with `type === "get-stream-settings"` which will return a JSON object containing all current stream configurations.

{% hint style="warning" %}
Updates to the stream's configuration can only be made once you have received the `ready` loading state
{% endhint %}

## Available quality settings

Here are the available quality settings that can be modified:

* `MinQP` - the lower bound for QP when encoding. By default the `MinQP` is 1 meaning the encoder is free to aim for the best quality it can on the given network. Valid values are 1-51 where:
  * 1 = best quality but highest bitrate
  * 51 = worst quality but lowest bitrate
* `MaxQP` - the upper bound for QP when encoding. By default the `MaxQP` is 51 meaning the encoder is free to drop quality as low as needed on the given network. Valid values are 1-51 where:
  * 1 = best quality but highest bitrate
  * 51 = worst quality but lowest bitrate
* `WebRTCMinBitrate` - the minimum desired WebRTC bitrate. Note that poor network connections may experience issues if this value is set too high.
* `WebRTCMaxBitrate` - the maximum desired WebRTC bitrate. Note that setting this too low could result in a blocky video.
* `WebRTCFPS` - the maximum stream fps.

## Example functions

```typescript
type QualitySettings = {
  MinQP?: number
  MaxQP?: number
  WebRTCMinBitrate?: number
  WebRTCMaxBitrate?: number
  WebRTCFPS?: number
}

// update stream settings
setStreamQualitySettings(updatedSettings: QualitySettings) {
  // define and send message
  const data = {
  	type: "set-stream-settings",
  	value: updatedSettings,
  }
  const jsonString = JSON.stringify(data)
  channel.port2.postMessage(jsonString)
}

// retrieve stream settings
getStreamQualitySettings() {
  // define and send message
  const getQualityMessage = {type: "get-stream-settings"}
  const jsonString = JSON.stringify(data)
  channel.port2.postMessage(jsonString)
}
```


---

# 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.odyssey.stream/embed-in-a-website/manage-your-stream/stream-quality-settings.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.
