Defines configuration options for a CloudXR streaming session.

Defines all configuration parameters needed to create and configure a CloudXR streaming session. Required parameters must be provided, while optional parameters have sensible defaults.

const sessionOptions: SessionOptions = {
// Required parameters
serverAddress: '192.168.1.100',
serverPort: 49100,
useSecureConnection: false,
gl: webglContext,
perEyeWidth: 2048,
perEyeHeight: 1792,
referenceSpace: xrReferenceSpace,

// Optional parameters with defaults
deviceFrameRate: 90,
maxStreamingBitrateKbps: 150000,
codec: 'av1'
};
interface SessionOptions {
    serverAddress: string;
    serverPort: number;
    useSecureConnection: boolean;
    gl: WebGL2RenderingContext;
    perEyeWidth: number;
    perEyeHeight: number;
    referenceSpace: XRReferenceSpace;
    glBinding?: XRWebGLBinding;
    codec?: string;
    deviceFrameRate?: number;
    maxStreamingBitrateKbps?: number;
    telemetry?: {
        enabled?: boolean;
        appInfo?: { version?: string; product?: string };
    };
    enablePoseSmoothing?: boolean;
    posePredictionFactor?: number;
}

Properties

serverAddress: string

Address of the CloudXR Runtime.

Can be an IP address (e.g., '192.168.1.100') or hostname. For local development, use 'localhost' or '127.0.0.1'.

serverAddress: '192.168.1.100'  // IP address
serverAddress: 'cloudxr-server.local' // Hostname
serverAddress: 'localhost' // Local development
serverPort: number

Port of the CloudXR Runtime.

The default CloudXR Runtime port is 49100. Ensure this port is accessible and not blocked by firewalls.

49100
serverPort: 49100  // Default CloudXR port
useSecureConnection: boolean

Connect using secure connection (WSS/HTTPS).

When true, uses secure WebSocket (WSS) connection. When false, uses unsecured WebSocket (WS) connection. For production deployments, secure connections are recommended.

false
useSecureConnection: false  // Development
useSecureConnection: true // Production
gl: WebGL2RenderingContext

WebGL context for rendering.

Must be a WebGL2RenderingContext obtained from a canvas element. This context will be used for all CloudXR rendering operations.

const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl2');
// Use gl in sessionOptions
perEyeWidth: number

Width of each eye in pixels.

This should match the per-eye resolution you want to render. Must be a multiple of 16 for optimal performance. The actual stream width will be calculated as perEyeWidth * 2.

perEyeWidth: 2048  // Max width if using H264 codec
perEyeHeight: number

Height of each eye in pixels.

This should match the per-eye resolution you want to render. Must be a multiple of 16 for optimal performance. The actual stream height will be calculated as perEyeHeight * 9 / 4.

perEyeHeight: 1792  // Max height if using H264 codec
referenceSpace: XRReferenceSpace

XR reference space to use for coordinate system calculations.

This is used for getting the viewer pose from the XR frame and should be obtained from the WebXR session.

const referenceSpace = await xrSession.requestReferenceSpace('local-floor');
glBinding?: XRWebGLBinding

XR WebGL binding used to query viewport information for each eye.

Optional binding that provides additional viewport information. If not provided, default viewport calculations will be used.

const glBinding = new XRWebGLBinding(xrSession, gl);
codec?: string

Video codec for streaming.

Supported codecs: 'h264', 'av1'. AV1 provides better compression but requires more CPU/GPU resources for encoding/decoding.

'av1'
codec: 'av1'   // Better compression, more CPU intensive
codec: 'h264' // Faster encoding/decoding, larger bandwidth
deviceFrameRate?: number

Device frame rate (maximum FPS).

The server will treat this as a maximum FPS and choose an appropriate streaming frame rate that is lower than this value. Higher frame rates provide smoother motion but require more bandwidth.

90
deviceFrameRate: 90   // Quest 3 standard
deviceFrameRate: 120 // High refresh rate
deviceFrameRate: 72 // Lower power mode
maxStreamingBitrateKbps?: number

Maximum streaming bitrate in Kilobits per second.

Controls the maximum bandwidth used for streaming. Higher bitrates provide better quality but require more network bandwidth.

150000
maxStreamingBitrateKbps: 150000  // 150 Mbps
maxStreamingBitrateKbps: 100000 // 100 Mbps (lower bandwidth)
maxStreamingBitrateKbps: 200000 // 200 Mbps (high quality)
telemetry?: {
    enabled?: boolean;
    appInfo?: { version?: string; product?: string };
}

Telemetry configuration options

Type declaration

  • Optionalenabled?: boolean

    Enable telemetry collection. Default is true.

  • OptionalappInfo?: { version?: string; product?: string }

    Application information for telemetry

    • Optionalversion?: string

      Application version (e.g., "1.0.0")

    • Optionalproduct?: string

      Product name (e.g., "MyApp")

enablePoseSmoothing?: boolean

Enable secondary smoothing on predicted positions.

When enabled, applies an additional smoothing pass to reduce jitter in predicted positions. This only affects position, not orientation.

true
enablePoseSmoothing: false  // Disable position smoothing
posePredictionFactor?: number

Pose prediction factor (0.0 to 1.0) that scales the prediction horizon.

This multiplier is applied to the calculated prediction horizon for both position and orientation. A value of 1.0 uses full prediction, 0.5 uses half the prediction horizon, and 0.0 disables prediction entirely.

1.0
posePredictionFactor: 0.5  // Use 50% of calculated prediction
posePredictionFactor: 0.0 // Disable prediction