From the course: Advanced Node.js

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Handling range requests

Handling range requests - Node.js Tutorial

From the course: Advanced Node.js

Handling range requests

- [Instructor] So far, we've made a small HTTP server that can stream an MP4 video to the browser. But our streams only work in Firefox and Chrome. They don't work in Safari and we can't skip ahead. We cannot request the different range. For our video to work in Safari, we have to implement range requests. And this will also allow us to skip ahead to different starting points using the HTML5 video player. So let's go ahead and implement these range requests. I'm inside of chapter three, chapter three, lesson two. And in the Start folder, you'll find an index file that has the server that we left off creating. So you can start there or you can continue working with the file from the last chapter. Now, these range requests are actually handled via the headers. So if we wanna see what a range request looks like, we need to get this range variable from the headers. So req.headers or request headers. Range will let us know if we have a request range. And we'll go ahead and log that. And…

Contents