Last active
August 29, 2015 13:57
-
-
Save chrisseto/9655858 to your computer and use it in GitHub Desktop.
A small and simple video browser/streamer in nodejs
This file contains 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
var fs = require('fs') | |
var util = require('util') | |
var express = require('express'); | |
var serveIndex = require('serve-index'); | |
var querystring = require('querystring'); | |
var app = express(); | |
app.use(serveIndex(__dirname, { | |
'icons': true | |
})); | |
app.use('/static', express.static(__dirname)); | |
app.get(/^\/(?!static).*\.(mp4|mkv)/, function(request, response) { | |
console.log("Request:", request.path) | |
var path = querystring.unescape(request.path); | |
response.redirect('/static' + path); | |
}); | |
var server = app.listen(3005, function() { | |
console.log('Listening on port %d', server.address().port); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mkv's dont always have audio... Attempting to fix.