Fix streaming: MSE-first with go2rtc init protocol

- Switch from WebRTC-first to MSE-first streaming (more reliable
  across all camera types including high-res IP cameras)
- Send required {"type":"mse"} init message to go2rtc WebSocket
- Fix infinite re-render loop in configStore (pre-compute enabled
  cameras instead of deriving in selector)
- Fix mqtt_bridge global variable scope in broadcast()
- Add React ErrorBoundary for visible crash reporting
- Remove unused go2rtcUrl dependency from useStream hook
This commit is contained in:
root
2026-02-25 22:36:13 -06:00
parent ba2824ec56
commit b630ba0337
12 changed files with 112 additions and 69 deletions

View File

@@ -0,0 +1,32 @@
import React from 'react';
interface State {
error: Error | null;
}
export class ErrorBoundary extends React.Component<React.PropsWithChildren, State> {
state: State = { error: null };
static getDerivedStateFromError(error: Error) {
return { error };
}
render() {
if (this.state.error) {
return (
<div style={{ padding: 40, color: '#ef4444', background: '#0f0f0f', height: '100vh', fontFamily: 'monospace' }}>
<h1 style={{ fontSize: 24, marginBottom: 16 }}>App Error</h1>
<pre style={{ whiteSpace: 'pre-wrap', color: '#f59e0b' }}>{this.state.error.message}</pre>
<pre style={{ whiteSpace: 'pre-wrap', color: '#9ca3af', marginTop: 8, fontSize: 12 }}>{this.state.error.stack}</pre>
<button
onClick={() => window.location.reload()}
style={{ marginTop: 20, padding: '8px 16px', background: '#3b82f6', color: '#fff', border: 'none', borderRadius: 8, cursor: 'pointer' }}
>
Reload
</button>
</div>
);
}
return this.props.children;
}
}