简体   繁体   中英

Upload video to azure blob storage through azure media services .NET SDK

So far all the samples on azure regarding azure media services, expect that files in general must be stored locally in order to upload to azure media services.

The reason being is that the CreateFromFile() has two parameters: string filePath and options.

Example:


static public IAsset UploadFile(string fileName, AssetCreationOptions options)
{
    IAsset inputAsset = _context.Assets.CreateFromFile(
        fileName,
        options,
        (af, p) =>
        {
            Console.WriteLine("Uploading '{0}' - Progress: {1:0.##}%", af.Name, p.Progress);
        });

    Console.WriteLine("Asset {0} created.", inputAsset.Id);

    return inputAsset;
}

Now what if the video has been passed in the body of a post API? How would one try to approach such a challenge?

So far all the samples on azure regarding azure media services, expect that files in general must be stored locally in order to upload to azure media services.

It also supports to create IAsset from the blob CreateFromBlob , but it seems that creating IAsset from stream is not supported now. I also find an issue about this.

Now what if the video has been passed in the body of a post API? How would one try to approach such a challenge?

In your case if I understand correctly, you could save the files in you API server template folder/another Azure blob storage then delete it template files/blobs after finish the action.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM