Skip to content

Instantly share code, notes, and snippets.

@talltyler
Created February 9, 2018 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talltyler/46a0de8fc8825c771bec526b715d4704 to your computer and use it in GitHub Desktop.
Save talltyler/46a0de8fc8825c771bec526b715d4704 to your computer and use it in GitHub Desktop.
let http = require("http"),
raspivid = require('raspivid');
http.createServer(function (req, res) {
if (req.url != "/movie.mp4") {
res.writeHead(200, { "Content-Type": "text/html" });
res.end('<video src="http://localhost:8888/movie.mp4"></video>');
} else {
res.writeHead(200, {
"Content-Type": "video/mp4"
});
let video = raspivid();
video.pipe(res);
}
}).listen(8888);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment