Serving Video Content from Azure Blob Storage

后端 未结 5 1547
死守一世寂寞
死守一世寂寞 2020-12-25 08:15

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 vid

5条回答
  •  感情败类
    2020-12-25 08:32

    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=;AccountKey=;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);
    

提交回复
热议问题