summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cam_public/index.html2
-rw-r--r--noise.jpgbin0 -> 23666 bytes
-rw-r--r--noise2.jpgbin0 -> 23653 bytes
-rw-r--r--server.js39
4 files changed, 41 insertions, 0 deletions
diff --git a/cam_public/index.html b/cam_public/index.html
new file mode 100644
index 0000000..8bdde6e
--- /dev/null
+++ b/cam_public/index.html
@@ -0,0 +1,2 @@
+<h1>Hello, World!</h1>
+<img src="../stream.mjpeg"></img>
diff --git a/noise.jpg b/noise.jpg
new file mode 100644
index 0000000..d657b3a
--- /dev/null
+++ b/noise.jpg
Binary files differ
diff --git a/noise2.jpg b/noise2.jpg
new file mode 100644
index 0000000..865a788
--- /dev/null
+++ b/noise2.jpg
Binary files differ
diff --git a/server.js b/server.js
new file mode 100644
index 0000000..c887b1f
--- /dev/null
+++ b/server.js
@@ -0,0 +1,39 @@
+var express = require('express');
+var fs = require('fs');
+var MjpegProxy = require('mjpeg-proxy').MjpegProxy;
+
+var app = express();
+
+var cameras = [
+ {
+ url: 'http://admin:123456@192.168.0.117/videostream.cgi?rate=1'
+ },
+ {
+ url: 'http://admin:123456@192.168.0.178/videostream.cgi?rate=1'
+ }
+];
+
+var still_frames = [
+ fs.readFileSync(__dirname + '/noise.jpg'),
+ fs.readFileSync(__dirname + '/noise2.jpg'),
+];
+
+for (var camera_idx in cameras) {
+ var camera = cameras[camera_idx];
+ camera.proxy = new MjpegProxy(camera.url, still_frames)
+ app.get('/cam/' + camera_idx + '/stream.mjpeg', camera.proxy.proxyRequest);
+ app.use('/cam/' + camera_idx + '/browse',
+ express.static(__dirname + '/cam_public'));
+}
+
+app.get('/blackout', function(req, res) {
+ for (var camera_idx in cameras) {
+ var camera = cameras[camera_idx];
+
+ camera.proxy.on_air = !camera.proxy.on_air;
+ }
+ res.send('OK');
+});
+
+
+app.listen(8080);