Improve the web viewer UI [WIP] (#333)

* functional but style is bad

* banner. sidebar. tabs for controls/scene/camera_path/logs. websocket text field

* moved window. toggle scene button. next step: lint/clean code

* websocket and webrtc reconnection on url change

* reconnection on websocket change seems robust

* cleaned up errors and organized code

* fixing lint
This commit is contained in:
Ethan Weber authored and GitHub committed 2022-09-06 00:36:48 -07:00
1 parent 32517f4587
commit 4c77c4e7c0
28 files changed
+1136 -294

No files matched your search

@@ -36,7 +36,7 @@ export default function WebRtcWindow() {
username: 'openrelayproject',
credential: 'openrelayproject',
},
// extra STUN server(s):
// Extra STUN and TURN server(s):
// {
// urls: 'stun:stun.l.google.com:19302',
// },
@@ -83,6 +83,15 @@ export default function WebRtcWindow() {
});
}
};
pc.onclose = () => {
dispatch({
type: 'write',
path: 'webrtcState/isConnected',
data: false,
});
};
return pc;
};
@@ -161,7 +170,19 @@ export default function WebRtcWindow() {
console.log('[webrtc] starting process');
sendOffer();
});
}, []); // empty dependency array means only run once
// kill the webrtc connection on dismount
return () => {
if (pcRef.current !== null) {
dispatch({
type: 'write',
path: 'webrtcState/isConnected',
data: false,
});
pcRef.current.close();
}
};
}, [websocket]); // dependency to call this whenever the websocket changes
return (
<div className="WebRTCVideo">