9

I have an HTML5 web app that uses a video tag. Depending on the user actions, different parts of the video will be played in response. This video does not exceed 5MB.

I need this video to be entirely downloaded on the client otherwise the user will have to wait for buffering if the part to be played is at the end of the video. Indeed, browsers behavior is to ask if Range Request are supported and to get a HTTP 206 partial content response from my server nginx.

I found a way to do what I want using xhr2 to download the entire video as a BLOB. However, I was wondering if it would be possible, for browsers which do not support xhr2, to make nginx refused Range Request and to send a classic HTTP 200 response so that the browser will fetch the entire video.

Is that possible? Thank you very much for your help!

JuCachalot
  • 217
  • 1
  • 4
  • 6

1 Answers1

10

Set max_ranges to 0. This requires nginx 1.1.2 or higher.

Example:

location ~ \.mp4$ {
    max_ranges 0;
}
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • 2
    Thank you that's exactly what I was looking for. Unfortunately, this idea was not the right answer to my problem as an HTML5 video loaded without Range Request is not seekable: http://stackoverflow.com/questions/8088364/html5-video-will-not-loop. I didn't know that, I will try to find an other idea. – JuCachalot Sep 04 '13 at 09:34
  • I suggest you visit [so] and search for ways to preload content. – Michael Hampton Sep 04 '13 at 09:36