Question

I am trying to serve MP4 Video content from Azure Blob Storage. I can get the video to play in modern browsers by ensuring that the Blob's Content Type is set to video/mp4; however I am unable to seek backwards.

Dropping the same video into an S3 bucket yields the desired result so I am ruling out problems with the content.

Do I need to configure the Storage role in a specific way to serve video content?

Was it helpful?

Solution

it was not clear for me from @smarx's answer how to set that for my blob container - but after some googling i found the code below. Just execute it in LINQPad, and video will start streaming:

var storageAccount = CloudStorageAccount.Parse("AccountName=<accountName>;AccountKey=<accountKeyBase64>;DefaultEndpointsProtocol=http");
var blobClient = storageAccount.CreateCloudBlobClient();

// Get the current service properties
var serviceProperties = blobClient.GetServiceProperties();

// Set the default service version to 2011-08-18 (or a higher version like 2012-03-01)
serviceProperties.DefaultServiceVersion = "2011-08-18";

// Save the updated service properties
blobClient.SetServiceProperties(serviceProperties);

OTHER TIPS

You may try setting the default version for your storage account to 2011-08-18: http://blogs.msdn.com/b/windowsazurestorage/archive/2011/09/15/windows-azure-blobs-improved-http-headers-for-resume-on-download-and-a-change-in-if-match-conditions.aspx. It improves a couple things around range requests (probably what progressive download in your browser is doing). I haven't heard anything specific about video playback, but it can't hurt to try. :-)

For anyone coming here from google:

Azure has two types of storage accounts: StorageV1/V2 (default option selected when making new account) and BlobStorage.

While the StorageV2 option may have more features, it does not support partial content requests, meaning Chrome will not allow video seeking.

You can identify the type of storage you have in the Azure Portal by navigating to your Storage Account > Properties > Account Type

I tried playing a very small MP4 encoded blob directly from HTML5 video element with control enabled, i could use the control to scroll back and forth my video.

What is the size of your video content? Also you can use Fiddler to check the HTTP Headers to verify if they are expected or does they match exactly same when you use the same blob from S3 bucket?

If you can share your blob link, i can give a quick try and see what could be the issue.

You can do it via Powershell. Here is an example for Azures ARM (not classic, but you can convert it easily).

Select-AzureRmSubscription -SubscriptionName "subscription" $Name = 'storageaccountname' $resourcegroup = 'resourcegroup'

$sp = New-Object -TypeName Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties 

$sp.DefaultServiceVersion = "2017-04-17" $key = (Get-AzureRMStorageAccountKey -StorageAccountName $Name
-ResourceGroupName $resourcegroup).Value[1]

$context = New-AzureStorageContext -StorageAccountName $Name
-StorageAccountKey $key

$blobClient = $context.StorageAccount.Create
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top