Solution 1 :

According to my research, if you set enableRangeProcessing parameter to true, we will get range response。 For more details, please refer to the issue.

My test code

public async Task<IActionResult> Video() {
            var s = Request.Headers;
            var memory = new MemoryStream();

            BlobServiceClient blobServiceClient = new BlobServiceClient("DefaultEndpointsProtocol=https;AccountName=blobstorage0516;AccountKey=eGier5YJBzr5z3xgOJUb+snTGDKhwPBJRFqb2nL5lcacmKZXHgY+LjmYapIHL7Csvgx75NwiOZE7kYLJfLqWBg==;");
            BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient("test");
            var blob =containerClient.GetBlobClient("test.mp4");
            StorageTransferOptions options = new StorageTransferOptions();
            options.InitialTransferLength = 1024 * 1024;
            options.MaximumConcurrency = 20;
            options.MaximumTransferLength = 4 * 1024 * 1024;
            await blob.DownloadToAsync(memory,null, options);
            memory.Position = 0;
            return File(memory, new MediaTypeHeaderValue("video/mp4").MediaType, true); //enableRangeProcessing = true


enter image description here

Problem :

I have an mp4 video I’ve uploaded to Azure Blob Storage (blocks, storage v2). I am unable to serve the video using a <video> tag without there being a delay in playback as the video is completely downloaded from the server (with a 200 response status code).

(To make matters worse, and while not exactly relevant to my question because I think it’s more of a browser issue, the video is set to loop, and it is being redownloaded with each loop.)

I would instead like to stream the video using partial content ranges so that playback begins immediately.

I’ve tried sourcing the video directly, providing the absolute URI to the <video> tag src attribute; and I’ve also tried serving the video via an ASP .NET Core 3.1 controller method, returning a FileStreamResult and setting the enableRangeProcessing parameter to true. Here is that code:

public async Task<IActionResult> GetVideo(string videoUrl)
    var httpClient = new HttpClient();
    var stream = await httpClient.GetStreamAsync(videoUrl);
    return File(stream, new MediaTypeHeaderValue("video/mp4").MediaType, true);

It seems regardless of what I try, I cannot get a range response with a 206 status code. I’ve seen suggestions about using Azure Media Services, but it seems like overkill and that this should be something that’s just supported without having to incorporate yet another service.

Any help/suggestions would be greatly appreciated – thanks!


Comment posted by Ben Robinson

I’ve been struggling with this; DownloadTo(MemoryStream) was the answer! Thanks Could you explain (or refer me to) where the StorageTransferOptions values come from

Comment posted by Johnsonlu

Hi @jim-xu , it seems you are downloading the whole video into memory, is it possible to use the range request support of the Azure Blob Storage SDK? thanks

Comment posted by…

@Johnsonlu please refer to


Leave a Reply

Your email address will not be published. Required fields are marked *