Search code examples
google-app-enginevideoblobstore

Google App Engine cannot serve some of mp4 files


I uploaded 2 .mp4 videointo blobstore.
When I served 311.0KB mp4 video, there is no problem with it. I can play the video
But when I served 3.3MB mp4 video, video is not loaded. So I went to admin console, and click Blob Viewer menu. When I clicked to see 3.3MB video, it doesn't load as well. Why?

I am using free version of GAE.


Solution

  • After some time I found out that using the X-AppEngine-BlobKey and X-AppEngine-BlobRange is working fine. I use Django and here is part of the code that I use, it should give you the idea how it works

    response = HttpResponse()
    response['Accept-Ranges'] = 'bytes'
    response['Content-Type'] = content_type
    response['X-AppEngine-BlobKey'] = blob_key
    if 'HTTP_RANGE' in request.META:
        response['X-AppEngine-BlobRange'] = request.META['HTTP_RANGE']
    return response
    

    Please note that X-AppEngine-BlobRange is set to exactly the same value as range header in request. GAE documentation for that case might be a little bit confusing as the examples show values like "0-499" when it should be set to "bytes=0-499".