I am experimenting with a video streaming project. I am writing an IPTV stream in mp4 to disk using ffmpeg. The problem is that the file is live and I need it up to date, so it’s impossible to transfer to the player. At the moment, when I go to localhost: 3000 I get a video that plays from the beginning, if I rewind to the end with my hands, the playback stops
Here is the code:
var http = require("http"); var fs= require("fs"); http.createServer(function (req,res){ res.writeHead(200,{'Content-Type': 'video/mp4'}); var rs= fs.createReadStream("3.mp4"); rs.pipe(res); }).listen(3000); First: how to always give the current file?
Second: how to start giving the file not from the beginning?