0

I am serving what is essentially gifv files. I've noticed is doing multiple requests to retrieve video in chunks.

I have hunch that it would be better performance for users if video's were served at once, rather than doing multiple requests.

I assume it's browser who really controls the transaction, but unfortunately I have not found the path how or why exactly (could be autoplay). To validate my assumptions, it would be nice to disable range downloads on the server thyself.

2

While there is no supported "disable range requests" feature, you could force this behavior by messing with encodings.

GCS supports range headers, but files uploaded with gzip encoding are special (as documented here: https://cloud.google.com/storage/docs/transcoding#range ). If a file is uploaded with gzip encoding (and the "contentEncoding" property indicates this), and also a client attempts to download the file without specifying that they accept that content encoding, GCS will ignore Range headers and serve the decoded object.

The next problem for you is that most web browsers do accept gzip encoding. You'll need to disable that in order to test your theory. Try grabbing an extension for your browser of choice that lets you disable accept-encoding headers.

  • 1
    Thank you, that worked a treat :). The solution is basically 9 characters in my nodejs cloud function: gzip: true when uploading the file. In reality my theory did not work that well. What happens instead is that player does not start until the whole video downloads, essentially making UX worse. – Dzh Jul 22 '17 at 1:21
  • 2
    A little correction - the video would not play immediately NOT because of range header, but because video metadata was located at the end of the file. Adding .outputOptions('-movflags faststart') to my fluent-ffmpeg process helped resolving this. – Dzh Jul 22 '17 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.