Created
February 9, 2018 12:07
-
-
Save talltyler/46a0de8fc8825c771bec526b715d4704 to your computer and use it in GitHub Desktop.
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
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