From a9a676bc70e7ec6f12eb5d0f801451d201fbdcc6 Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Sat, 21 Mar 2026 23:30:46 +0100 Subject: [PATCH] feat: expand admin streaming pills, add high-end resource warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces hardcoded 3-resolution/3-framerate arrays with ALL_RESOLUTIONS and STANDARD_FRAMERATES from shared constants (540p–Native, 30–120 fps). Adds amber warning banner when high-end options (≥1440p or ≥75 fps) are enabled, and fixes toggleResolution to handle 'native' with correct sort. --- .../instanceSettingsPanels/StreamingPanel.tsx | 51 +++++++++++++++---- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/packages/web/src/components/modals/instanceSettingsPanels/StreamingPanel.tsx b/packages/web/src/components/modals/instanceSettingsPanels/StreamingPanel.tsx index c38f2b5d..af677f16 100644 --- a/packages/web/src/components/modals/instanceSettingsPanels/StreamingPanel.tsx +++ b/packages/web/src/components/modals/instanceSettingsPanels/StreamingPanel.tsx @@ -1,9 +1,12 @@ import { useState, useEffect } from 'react'; import { useSettingsStore } from '../../../stores/settingsStore'; import type { InstanceStreamingLimits } from '@backspace/shared'; - -const VALID_RESOLUTIONS = [540, 720, 1080] as const; -const VALID_FRAMERATES = [30, 45, 60] as const; +import { + STANDARD_FRAMERATES, + ALL_RESOLUTIONS, RESOLUTION_LABELS, + HIGH_END_RESOLUTION_THRESHOLD, HIGH_END_FRAMERATE_THRESHOLD, + type Resolution, +} from '@backspace/shared/src/constants'; function formatKbps(kbps: number): string { return kbps >= 1000 @@ -48,7 +51,7 @@ export function StreamingPanel() { setSaveError(''); }; - const toggleResolution = (res: number) => { + const toggleResolution = (res: number | 'native') => { const current = new Set(draft.allowedResolutions); if (current.has(res)) { if (current.size <= 1) return; @@ -56,7 +59,10 @@ export function StreamingPanel() { } else { current.add(res); } - setDraft({ ...draft, allowedResolutions: Array.from(current).sort((a, b) => a - b) }); + // Sort: numbers ascending, 'native' always last + const nums: (number | 'native')[] = Array.from(current).filter((r): r is number => r !== 'native').sort((a, b) => a - b); + if (current.has('native')) nums.push('native'); + setDraft({ ...draft, allowedResolutions: nums }); }; const toggleFramerate = (fps: number) => { @@ -160,14 +166,14 @@ export function StreamingPanel() {
Allowed Resolutions
-
- {VALID_RESOLUTIONS.map((res) => ( +
+ {ALL_RESOLUTIONS.map((res) => ( ))}
@@ -178,8 +184,8 @@ export function StreamingPanel() {
Allowed Frame Rates
-
- {VALID_FRAMERATES.map((fps) => ( +
+ {STANDARD_FRAMERATES.map((fps) => (
+ {/* High-end resource warning */} + {(draft.allowedResolutions.some( + (r) => r === 'native' || (typeof r === 'number' && r >= HIGH_END_RESOLUTION_THRESHOLD) + ) || draft.allowedFramerates.some( + (f) => f >= HIGH_END_FRAMERATE_THRESHOLD + )) && ( +
+
+ + + +
+ High-performance settings enabled.{' '} + Streaming above 1080p or 60 fps requires significant client-side CPU/GPU encoding + power and can saturate server bandwidth, especially when streams are routed through + TURN. High-end configurations (e.g., 4K at 120 fps) can require up to 45 Mbps per + active stream. Ensure your infrastructure can handle this load before enabling these + options for all users. +
+
+
+ )} + {/* Save / Reset */} {saveError && (
{saveError}