Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.