13

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?

Askolein
  • 3,250
  • 3
  • 28
  • 40
JonnyReeves
  • 6,119
  • 2
  • 26
  • 28
  • How does your video content is playing in browser through a web based player or launch? Is it streaming or downloaded full first and then play? Do u have link to access it and take a look? – AvkashChauhan Jul 16 '12 at 19:41
  • The content is being displayed though a standard HTML5 ` – JonnyReeves Jul 17 '12 at 09:10

6 Answers6

18

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);
avs099
  • 10,937
  • 6
  • 60
  • 110
  • 1
    This worked for me as well. I set mine to 2016-05-31. I had to do this on a brand new storage account. I'm not sure why Azure wouldn't set the newest version when you create a new storage account. – guyfromfargo Jan 05 '17 at 18:03
  • 1
    If you're looking for the latest version: https://learn.microsoft.com/en-us/rest/api/storageservices/versioning-for-the-azure-storage-services. At the time of this comment the newest version is 2019-07-07 – Ziad Akiki Jun 05 '20 at 14:25
7

To anyone who wants to use the Azure CLI:

az storage account blob-service-properties update --account-name [account_name] --default-service-version '2020-10-02'
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Brando
  • 91
  • 1
  • 2
5

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. :-)

user94559
  • 59,196
  • 6
  • 103
  • 103
  • You're my hero! Changing the `DefaultServiceVersion` to `2011-08-18` via the service:properties endpoint did the trick - the video now seeks correctly! Do you know if there's an easier way to change this setting for storage accounts than manually crafting a `WebRequest` object in my C# code? – JonnyReeves Jul 20 '12 at 10:48
  • 1
    I don't know, sorry. There isn't a method in the storage client library? – user94559 Jul 20 '12 at 15:41
  • For future reference, yes, there is - the C# code is listed at the bottom of the msdn blog post references in smarx's answer. – JonnyReeves Jul 31 '12 at 08:28
4

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

cryocaustik
  • 439
  • 2
  • 8
  • 20
  • 2
    I don't see any field or heading for "Account type" in the Azure Portal > Storage Account > Properties. Also, the page you linked to about Storage vs StorageV2 makes no mention of "partial" requests at all. – Dai May 21 '19 at 16:54
0

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.

AvkashChauhan
  • 20,495
  • 3
  • 34
  • 65
0

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