将视频保存为azure,无法加载视频一段时间

时间:2017-12-15 09:13:25

标签: angularjs azure video

大家好,我有以下代码将视频保存到azure,这很好用。但是当我加载视频并试图播放它们时,我无法播放它们中的一些。我使用服务执行此操作,每2秒执行一次,以记录角度服务中的视频

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;
}

视频正在上传,但当我尝试观看视频时,视频无法显示。我正在使用类似的这种情况,我每隔2秒就调用一次服务将视频保存到azure

https://www.webrtc-experiment.com/RecordRTC/

0 个答案:

没有答案