diff --git a/README.md b/README.md index f6c9aa8..bdc0225 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # Media Source Tutorial To host locally npm install and then node app.js + + +This repo contains the source files for a [blog series on WIREWAX.com](https://www.wirewax.com/blog/post/building-a-media-source-html5-player). \ No newline at end of file diff --git a/app.js b/app.js index 374a7b2..93afd25 100644 --- a/app.js +++ b/app.js @@ -20,7 +20,7 @@ app.configure(function () { app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); - app.use(express.static(path.join(__dirname, 'public'))); + app.use('/', express.static(path.join(__dirname, 'public'))); app.engine('html', require('ejs').renderFile); app.use(express.errorHandler()); }); @@ -30,6 +30,7 @@ var server = app.listen(3105); exports = module.exports = app; // Routes +app.get('/', routes['index']); app.get('/basic', routes['basicPlayer']); app.get('/buffering', routes['bufferingPlayer']); app.get('/adaptive', routes['adaptiveStreamingPlayer']); diff --git a/package.json b/package.json index 43ff456..bcef273 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "mediaSourceTutorial", "version": "0.0.1", "dependencies": { + "ejs": "^2.5.5", "express": "3.3.4", - "request": "~2.22.0" + "request": "~2.22.0" } } diff --git a/routes/index.js b/routes/index.js index 542a492..883c0a0 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,3 +1,6 @@ +exports.index = function(req, res) { + res.render('index.html'); +}; exports.basicPlayer = function(req , res){ res.render('basic-player.html'); }; diff --git a/views/index.html b/views/index.html new file mode 100644 index 0000000..22da67f --- /dev/null +++ b/views/index.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + +
+ Basic player +
+ Buffering player +
+ Adaptive streaming player +
+ + \ No newline at end of file