Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: resolve race condition in Media page video display

Adam Eivy89069fac494a
diff --git a/client/src/pages/Media.jsx b/client/src/pages/Media.jsx
index afaa4c8b36..26b1b3acdf 100644
--- a/client/src/pages/Media.jsx
+++ b/client/src/pages/Media.jsx
@@ -124,10 +124,6 @@ export default function Media() {
setStream(mediaStream);
setPermissionState('granted');
- if (videoRef.current && videoEnabled) {
- videoRef.current.srcObject = mediaStream;
- }
-
if (audioEnabled) {
setupAudioAnalyser(mediaStream);
}
@@ -214,6 +210,13 @@ export default function Media() {
};
}, [stopMedia]);
+ // Set video srcObject when stream changes (handles async state update)
+ useEffect(() => {
+ if (videoRef.current && stream && videoEnabled) {
+ videoRef.current.srcObject = stream;
+ }
+ }, [stream, videoEnabled]);
+
// Handle device change
const handleDeviceChange = useCallback(async (type, deviceId) => {
if (type === 'video') {