Hello all I am having the following code to save video to azure, which is working fine. But when I am loading the videos and trying to play them I am unable to play some of them. I am calling this using a service to execute for every 2 seconds to record the video from the angular service
- public async Task<int> Save(System.IO.Stream stream, string name)
- {
- MemoryStream memStream = new MemoryStream();
- stream.CopyTo(memStream);
- memStream.Position = 0;
- // Parse the connection string and return a reference to the storage account.
- CloudStorageAccount storageAccount = CloudStorageAccount.Parse(AzureConfig.CONNECTION_STRING);
- CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
- ServiceProperties serviceProperties = await blobClient.GetServicePropertiesAsync();
- // Set the default service version to be used for anonymous requests.
- serviceProperties.DefaultServiceVersion = "2016-05-31";
- // Set the service properties.
- await blobClient.SetServicePropertiesAsync(serviceProperties);
- // Retrieve a reference to a container.
- CloudBlobContainer container = blobClient.GetContainerReference("video");
- // Retrieve reference to a blob named "myblob".
- CloudAppendBlob appBlob = container.GetAppendBlobReference(name + ".webm");
- if (!await appBlob.ExistsAsync())
- {
- await appBlob.CreateOrReplaceAsync();
- }
- appBlob.Properties.ContentType = "video/webm;codecs=vp9";
- await appBlob.SetPropertiesAsync();
- appBlob.Metadata.Add(new KeyValuePair<string, string>("uploadedDate", DateTime.Now.ToString()));
- await appBlob.AppendFromStreamAsync(memStream);
- return 0;
- }
The video is getting uploaded but when I am trying to view the video some times the video is not getting displayed. I am using similar kind of this where for every 2 seconds I am calling a service to save the video in to azure
https://www.webrtc-experiment.com/RecordRTC/
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Madan ShekarPosted May 14, 2018, 1:52 AM