moonfire-nvr
moonfire-nvr copied to clipboard
fancy scrub bar UI
I've written the server-side code to support segmented .mp4
files for HTML5 Media Source Extensions. (design/api.md talks about this.) It may have some bugs but is essentially complete.
The goal was that to use this to create the classic NVR UI where there's a scrub bar at the bottom showing an entire day, it grows over time as new stuff is recorded, and none of this has to wait for huge moov
segments to transfer.
I think this needs some significant work to be viable, though:
- ~~debug the current segmented
.mp4
files. I noticed some of them were working, some weren't. I'm not sure what was different. Maybe related to #43.~~ I think as part of getting the live view working I got this stuff all figured out. See 478323e.- a bunch of Javascript UI work. probably an automated test setup for UI changes with headless Chrome/Firefox or something.
- event stream (#40)
- some way of sending HTTP requests for video data, streaming the response back, and being able to cancel it when you seek to another part of the video.
- XMLHTTPRequest: but apparently only Firefox supports streaming arraybuffers with this. The other browsers don't return any response data until the response is complete, so there'd have to essentially be an HTTP request per frame, which is annoying.
- Fetch + Streams APIs: ~~but this is Chrome-only last I checked and doesn't support cancelling requests, so if you seek around a lot your connection will get quite congested while the system catches up with you.~~ fetch is well-supported by browsers now, including streams and cancellation.
- WebSockets: this supports both streaming and cancellation, so I think it's the best way to go. ~~But it requires some additional server-side work. hyper annoyingly doesn't support sharing the HTTP port with a WebSockets implementation. Could use a separate port for now.~~ The live view uses WebSockets now. But given that fetch works well now, I don't think we need to add a WebSockets API for existing segments.
Assuming we only start loading in the mp4 segments on scrubbar release, I think progressive scrubbing (display the scrub thumbnail in the video window) would also be a great feature.