Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.streampixel.io/llms.txt

Use this file to discover all available pages before exploring further.

This page documents the StreamPixelApplication function and the configuration options it accepts.

The StreamPixelApplication function

import { StreamPixelApplication } from 'streampixelsdk';

const result = await StreamPixelApplication(settings);
StreamPixelApplication is an async function that initializes the SDK. It:
  1. Fetches your project configuration from the Streampixel API using the appId
  2. Detects the user’s device type (desktop, tablet, or mobile)
  3. Negotiates the best available video codec
  4. Establishes a WebSocket connection to the signaling server
  5. Returns an object with all the tools you need to control the stream

Singleton behavior

StreamPixelApplication can only be called once per page load. If called again, it logs a warning and returns an empty object {}. If you need to reinitialize, reload the page.

The appId parameter

The appId is the only required parameter. Everything else is optional and falls back to your dashboard configuration.
The appId is your project identifier from the Streampixel dashboard. The API uses it to resolve:
  • Which signaling server region to connect to
  • TURN server credentials
  • UE instance pool and routing
  • All default settings configured in your dashboard

Dashboard defaults

Every configuration option (except appId) is optional. When omitted, the SDK uses the values configured in your Streampixel dashboard. SDK-side settings override dashboard settings.

Configuration options

Connection

ParameterTypeDefaultDescription
appIdstringRequiredProject ID from Streampixel dashboard
AutoConnectbooleanfalseAutomatically connect to the stream on initialization
streamerIdstringAuto-generated UUIDTarget a specific UE streamer instance
sfuHoststring"false"Set to "true" to act as SFU host (one-to-many streaming)
sfuPlayerstring"false"Set to "true" to act as SFU viewer
forceTurnbooleantrueForce TURN relay for NAT traversal (recommended)

Codec

ParameterTypeDefaultDescription
primaryCodecstringDashboard valuePreferred video codec: "H264", "VP8", "VP9", or "AV1"
fallBackCodecstringDashboard valueFallback codec if primary is unavailable

Resolution

ParameterTypeDefaultDescription
maxStreamQualitystring"1080p (1920x1080)"Maximum allowed resolution
startResolutionstring"1080p (1920x1080)"Initial resolution for desktop users
startResolutionMobilestring"480p (854x480)"Initial resolution for mobile users
startResolutionTabstring"720p (1280x720)"Initial resolution for tablet users
resolutionModestring"Fixed Resolution Mode"One of: "Fixed Resolution Mode", "Dynamic Resolution Mode", "Crop on Resize Mode"
showResolutionbooleanDashboard valueEnable resolution selection UI control
Resolution preset format: "1080p (1920x1080)". Available presets:
  • "360p (640x360)"
  • "480p (854x480)"
  • "720p (1280x720)"
  • "1080p (1920x1080)"
  • "1440p (2560x1440)"
  • "4K (3840x2160)"

Bitrate and quality

ParameterTypeDefaultDescription
minBitratenumber1Minimum bitrate in Mbps
maxBitratenumber100Maximum bitrate in Mbps
minQPnumber20Minimum quantization parameter (1-51, lower = better quality)
maxQPnumber-1Maximum quantization parameter (-1 = no limit)

Input

ParameterTypeDefaultDescription
mouseInputbooleantrueEnable mouse input
keyBoardInputbooleantrueEnable keyboard input
touchInputbooleantrueEnable touch input
gamepadInputbooleantrueEnable gamepad/controller input
xrInputbooleantrueEnable WebXR (VR/AR) input
hoverMousebooleantrueSend mouse hover/move events to UE
fakeMouseWithTouchesbooleanfalseConvert touch events to mouse events

Audio and camera

ParameterTypeDefaultDescription
useMicbooleantrueEnable microphone input to UE
useCamerabooleantrueEnable camera input to UE

AFK

ParameterTypeDefaultDescription
afktimeoutnumber120Idle timeout in seconds before disconnecting (1-7200)

Example: full configuration

const { appStream, pixelStreaming, queueHandler, UIControl, reconnectStream } =
  await StreamPixelApplication({
    // Required
    appId: 'your-project-id',

    // Connection
    AutoConnect: true,
    forceTurn: true,

    // Codec
    primaryCodec: 'H264',
    fallBackCodec: 'VP8',

    // Resolution
    maxStreamQuality: '1080p (1920x1080)',
    startResolution: '1080p (1920x1080)',
    startResolutionMobile: '480p (854x480)',
    startResolutionTab: '720p (1280x720)',
    resolutionMode: 'Fixed Resolution Mode',

    // Bitrate
    minBitrate: 5,
    maxBitrate: 50,

    // Input
    mouseInput: true,
    keyBoardInput: true,
    touchInput: true,
    hoverMouse: true,

    // Audio
    useMic: false,
    useCamera: false,

    // AFK
    afktimeout: 300,
  });

Next steps

Return values

Understand the five objects returned by StreamPixelApplication.

Connection lifecycle

Hook into the events fired during connection setup.