通过Xamarin将video上传到Azure存储

我正在尝试将video文件上传到我的Azure存储帐户。 我已经使用了图像,但是尝试查看上传的video会显示“不支持video格式或MIME类型”的消息。 video格式为mp4。

我使用以下代码上传:

public async Task UploadVideo(Stream video, string path) { var container = GetContainer("videos"); // Creates the container if it does not exist await CreateContainer(container); //Gets the file extension string lastPart = path.Split('.').Last(); // Uploads the video to the blob storage CloudBlockBlob videoBlob = container.GetBlockBlobReference(path); videoBlob.Properties.ContentType = "video/" + lastPart; await videoBlob.UploadFromStreamAsync(video); } 

难道我做错了什么?

谢谢

编辑:

这是我用来在手机上捕获video的代码:

  private async Task TakeVideoButton_Clicked(object sender, EventArgs e) { if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakeVideoSupported) { await DisplayAlert("No Camera", ":( No camera avaialble.", "OK"); return; } mediaFile = await CrossMedia.Current.TakeVideoAsync(new Plugin.Media.Abstractions.StoreVideoOptions { Name = "video.mp4", Directory = "DefaultVideos", }); if (mediaFile == null) return; await DisplayAlert("Video Recorded", "Location: " + mediaFile.Path, "OK"); videoStream = mediaFile.GetStream(); file.Dispose(); } 

我刚刚在手机上测试了这个而不是我的模拟器,它在那里工作得很好,所以我假设它纯粹是模拟器相关的问题。