Express middleware for streaming video.
npm install -S video-stream
Call videoStream
middleware passing the directory that we should look for videos.
const path = require('path')
const express = require('express')
const videoStream = require('video-stream')
const app = express()
// video-stream route
app.get('/video/:filename', videoStream({ dir: path.resolve(__dirname) }))
// Your normal routes
app.get('/', (req, res) => {
res.send('Hello World')
res.end()
})
app.listen(3000, () => {
console.log(`Listening on port 3000`)
})
Check a working example on example folder.
caiogondim.com · GitHub @caiogondim · Twitter @caio_gondim