Stream your video file from nodejs server to client
npm install videon
// SERVER
// Require the library
const Streamer = require("videon");
const express = require("express");
const app = express();
app.get("/video", (req, res) => {
const str = new Streamer("/* File Path */", /* Stream Chunk */, req, res);
// Start stream
str.start();
// Stop stream
str.stop();
});
app.listen(5000, () => {
console.log("Server running on port 5000");
});
-----------------------------
// CLIENT
<video class="stream" controls autoplay muted>
<source src="/video" type="video/mp4" />
</video>
- File Path: full directory to the video
- Stream Chunk: This determines how much byte would be streamed per peroid rather than the full video, the default and minimum is 3 which would send 1kb. 4 - 10kb, 5 - 100kb, 6 - 1mb and so on.
For inquires, support, bug reports and suggestions send me a mail@: confidostic3@gmail.com
- Github: https://github.com/ConfidenceDev/NodeJS-Video-Stream-Lib
- Facebook: Confidence Eze
- Twitter: @ConfidenceDev
- Instagram: @confidence.dev