Stream quality settings

Overview

Manage and retrieve pixel stream configuration settings to tailor your application's performance.

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

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

Updates to the stream's configuration can only be made once you have received the ready loading state

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

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

Last updated