

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Streaming a video file to an HTML5 video player with Node.js so that the video controls continue to work
Use createReadStream to send the requested part to the client. The function call createReadStream() will give you a readable stream.
Example
The following is the code −
stream = fs.createReadStream(path); stream.on('open', function () { res.writeHead(206,{ "Content-Range":"bytes " + begin + "-" + end + "/" +total, "Accept-Ranges":"bytes", "Content-Length":chunksize, "Content-Type":"new/mp4" }); stream.pipe(res); });
- Related Questions & Answers
- Play local (hard-drive) video file with HTML5 video tag?
- HTML DOM Video controls Property
- How to take a snapshot of HTML5-JavaScript based video player?
- Commonly used Video formats while using HTML5 video
- How to include the audio/video controls in HTML?
- Display video inside HTML5 canvas
- Use CSS width property for a responsive video player
- HTML5 video not playing in Firefox
- HTML5 video full preload in JavaScript
- Using FFMPEG with HTML5 for online video hosting
- Converting video to HTML5 ogg / ogv and mpg4
- Use CSS max-width property responsive for video player
- Facing Problem in retrieving HTML5 video duration
- HTML 5 Video Buffering a certain portion of a longer video
- How to prevent the HTML5 video from loading before playing?
Advertisements