Add streaming functionality for 3D renders #323
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #169
This PR introduces an Express server (src/main/MJPEGServer.ts) running on ports 1181-1189 to support MJPEG streaming. Users can right-click on the 3D view to access a "Set Stream Settings..." option, which opens a mini-window to configure:
Settings persist on the Hub but not on Satellites (similar to FOV behavior).
fps
param in the URL to configure the stream FPS. The default is 30 FPS.The renderer converts the rendered canvas to a Data URL, sending it to MJPEGServer, which serves it via Express. However, the stream requires the tab to remain active (on the Hub) or the window to stay open (on a Satellite). Attempts to mitigate this by modifying the if statement in the ThreeDimension renderer to
if (this.canvas.getBoundingClientRect().width === 0 && !this.streamSettings.streamEnable) {...
were unsuccessful.