12 - On demand streaming

Most video or audio playing software (like VLC) have a way to stream content from an HTTP server using range requests. Let's create a bridge that exposes our application as an HTTP endpoint.

Tips

Make sure the bridge supports the HTTP Range header.

When an HTTP client wants only part of a file being served by the server, it can set the Range header to indicate which bytes it wants to fetch:

Range: bytes=500-999

Use the range-parser module to make this easy.

Here's some files to get started:

Assignment

Create an HTTP server that bridges the p2p application.

Tests

Share a video file using the server and see if you can play it in VLC by connecting to the bridge.

What's next?

If you get this far, here's a few ideas for how to expand your p2p program: