Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5412 closed enhancement (invalid)

Add "Accept-Ranges: bytes" response header and support for videos

Reported by: Mike Swierczek Owned by:
Priority: minor Milestone:
Component: programming Keywords:
Cc: Parent Tickets:

Description

For streaming large (greater than 1GB) WebM videos, support for the "Accept-Ranges: bytes" header indicates to the browser that partial content requests are supported. This allows the viewer to jump around the video without having to wait for the whole video to load.

To see this in action, take a large (greater than 1 GB) WebM file and load it onto Mediagoblin, and then try to watch it from the middle. Use the download link to open the video in its own browser tab, and try to watch it in the middle. Again, it will hang for a long time as the data buffers. If you use browser tools to examine the request, the request will have one HTTP 200 response.

Host the same video on nginx and watch it through the browser. You will be able to jump around the content as you like. If you examine the network traffic, there will be an HTTP 200 response for the first request and then HTTP 206 Partial Content responses for each click to navigate.

I'm going to try to figure this out myself, but Python isn't my normal playground. A Mediagoblin developer will probably be much faster.

Change History (3)

comment:1 by Mike Swierczek, 8 years ago

The change I needed was in the Werkzeug Python library. I figured it out locally and submitted a pull request to the original project on Github: https://github.com/mitsuhiko/werkzeug/pull/867

If the Werkzeug developers accept it, then a future release of Mediagoblin only needs to update its dependency to gain the feature. If not, maybe someone else in this project can implement it better than I did in that pull request.

comment:2 by Mike Swierczek, 8 years ago

Resolution: invalid
Status: newclosed

Upon further testing, I see that a production deployment of Mediagoblin that uses nginx to serve media files has the Accept-Ranges: bytes and HTTP 206 Partial Content feature. So my change is only useful when launching with the ./lazyserver.sh --server-name=broadcast

I suggest instead that the documentation be updated to note that when running Mediagoblin using "./lazyserver.sh --server-name=broadcast" serving large movie files will not work well.

comment:3 by Christopher Allan Webber, 8 years ago

Right, the broadcast stuff is just for testing. Cool to see this might end up in werkzeug though!

If you have documentation change suggestions I'm open to them.

Note: See TracTickets for help on using tickets.