Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAssetFile.Upload(Stream stream) #195

Open
Hyjaz opened this issue Dec 30, 2017 · 1 comment
Open

IAssetFile.Upload(Stream stream) #195

Hyjaz opened this issue Dec 30, 2017 · 1 comment

Comments

@Hyjaz
Copy link

Hyjaz commented Dec 30, 2017

I have been using the Upload function from the IAssetFile Interface for a couple of days now, to upload to azure media services.

However today it has stopped working.

I have narrowed down that error is coming from the Upload(Stream stream) function. I.e. something is going wrong during the uploading. And because of that whenever I start a job on Azure Media Services it always returns the following error:
The first error is when I run "Azure Media Redactor" and the second one is when I run "Media Encoder Standard"
Both of these were working previously. I have not touched my code.

Additionally here is the link to the question I asked on stackoverflow:
https://stackoverflow.com/questions/48031430/azure-media-services-strange-beheviour

image

Here is the code I use to upload assets:

foreach (var content in provider.Contents) 
    {
    // Upload as an asset to Azure Media services
            IAsset asset = await _service.CreateAssetAndUploadSingleFile(content, "Input Asset");
    }

Here is my CreateAssetAndUploadSingleFile Function:

            public async Task<IAsset> CreateAssetAndUploadSingleFile(HttpContent content, string assetName, AssetCreationOptions options = AssetCreationOptions.None)
        {
            IAsset asset = _context.Assets.Create(assetName, options);
            Console.WriteLine(content.Headers.ContentDisposition.FileName);
            IAssetFile assetFile = await asset.AssetFiles.CreateAsync("love.mp4", CancellationToken.None);
            if (content != null)
            {
                Console.WriteLine("creating stream");
                using (Stream stream = await content.ReadAsStreamAsync())
                {
                    Console.WriteLine("Uploading to blob storage");
                    assetFile.Upload(stream);
                    return asset;
                }
            }
            return asset;
        }
@Hyjaz
Copy link
Author

Hyjaz commented Dec 31, 2017

I have found why I face redactor couldn't run.

Once I upgraded windowsazure.mediaservices to version 4.1.0.1, and called the upload function where the signature is simply a Stream, it was uploading zero bytes.

However the same code, with version 4.1.0.0, uploads correctly.

If this repo is not the one in which I should comment, please let me know in which repo I should post my problem.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant