Last active
July 3, 2020 19:21
-
-
Save gevorg/f6d8e3423f2bf88363c839f3873248e1 to your computer and use it in GitHub Desktop.
Video Streaming
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
<video width="400" height="300" autoplay controls> | |
<source src="video.mp4" type="video/mp4"> | |
</video> | |
<video width="400" height="300" autoplay controls> | |
<source src="video2.mp4" type="video/mp4"> | |
</video> |
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
const PORT = 8080; | |
const express = require('express'); | |
const app = express(); | |
const fs = require('fs'); | |
app.get('/', function (req, res) { | |
res.sendFile(`${__dirname}/index.html`); | |
}); | |
app.get('/video.mp4', function (req, res) { | |
res.sendFile(`${__dirname}/video.mp4`); | |
}); | |
app.get('/video2.mp4', function (req, res) { | |
fs.readFile(`${__dirname}/video.mp4`, function read(err, data) { | |
res.send(data); | |
}); | |
}); | |
app.listen(PORT, function () { | |
console.log(`app listening on port ${PORT}!`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment