0
votes

I find some relevant answers but none that explains if I really need all the code from the Azure Media Services teams example at https://azure.microsoft.com/en-us/documentation/articles/media-services-copying-existing-blob/ I just want to upload a file from blob to Azure Media Services. Like this:

  var uploadFilePath = blobUrl;
  var uploadAsset = _context.Assets.Create(Path.GetFileNameWithoutExtension(uploadFilePath), AssetCreationOptions.None);
  var assetFile = uploadAsset.AssetFiles.Create(Path.GetFileName(uploadFilePath));
  assetFile.Upload(uploadFilePath);

But I'm getting

AggregateException was unhandled by user code, "An exception of type 'System.AggregateException' occurred in mscorlib.dll but was not handled in user code"

Stack trace

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.WindowsAzure.MediaServices.Client.AssetFileData.Upload(String path) at UploadMediaServicesExample.Services.MediaHandler.AddFileToMediaServices(String blobUrl) in C:\Source\UploadMediaServicesExample\UploadMediaServicesExample\Services\MediaHandler.cs:line 51 at UploadMediaServicesExample.Controllers.HomeController.UploadVideo(IEnumerable1 file) in C:\Source\UploadMediaServicesExample\UploadMediaServicesExample\Controllers\HomeController.cs:line 24 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.b__3f()

Additional information: One or more errors occurred.

Here is the blob Uri which is public.. "https://mulimo.blob.core.windows.net/temporary-files/clip.mp4"

1

1 Answers

1
votes

Asset file upload method not supporting upload from blobs. It is only working with local files. Regarding exception you should see message in inner exception message property. You can use azure media services extensions (or see how it is done there) https://github.com/Azure/azure-sdk-for-media-services-extensions to create asset from existing blob.