This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get all users | |
| var url = "http://localhost:8080/api/v1/users"; | |
| var xhr = new XMLHttpRequest() | |
| xhr.open('GET', url, true) | |
| xhr.onload = function () { | |
| var users = JSON.parse(xhr.responseText); | |
| if (xhr.readyState == 4 && xhr.status == "200") { | |
| console.table(users); | |
| } else { | |
| console.error(users); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream, | |
| // Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback | |
| var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance | |
| // For live streaming, create a fragmented MP4 file with empty moov (no seeking possible). | |
| var reqUrl = url.parse(req.url, true) | |
| var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined; | |
| if (cameraName) { | |
| try { | |
| cameraName = decodeURIComponent(cameraName); |