hilda_sonica_vish
hilda_sonica_vish

Reputation: 757

azure media service for xamarin?

I have created a console application with azure media service.

in the app i am using the plugin

windowsazure.mediaservices

the way i am doing is

  static IAsset CreateAssetAndUploadSingleFile(string filePath, string assetName, AssetCreationOptions options)
        {
            IAsset asset = _context.Assets.Create(assetName, options);
            var assetFile = asset.AssetFiles.Create(Path.GetFileName(filePath));
            assetFile.Upload(filePath);
            return asset;
        }

so i just want to know whether this plugin will work on xamarin(i am not a xamarin devoloper) as its a portable project. if its not do we have any alternative plugin?

my basic purpose is upload and encode.

Upvotes: 1

Views: 186

Answers (2)

CularBytes
CularBytes

Reputation: 10321

As john answered, you don't do this stuff on a client, you will need to use SaS tokens and what not. I could explain everything here, but there are some nice guides and examples online.

Build 2018 video explaining how it works (including Azure Functions): https://www.youtube.com/watch?v=dEZkQNNpSIQ&feature=youtu.be&rel=0 The github example of this video: https://github.com/Azure-Samples/xamarin-azure-businessreview

To understand it better, I recommend this guide, it is old but it does cover the entire process, just make sure to combine new documentation with this old one. Old docu: https://learn.microsoft.com/en-us/previous-versions/msp-n-p/dn735912(v%3dpandp.10)

Official current documentation: https://learn.microsoft.com/en-us/azure/media-services/previous/media-services-dotnet-upload-files#upload-multiple-files-with-media-services-net-sdk

Probably useful for new readers.

Upvotes: 0

johndeu
johndeu

Reputation: 2512

That package is for our current .NET SDK https://www.nuget.org/packages/windowsazure.mediaservices

It does not support .NET Core. See the dependencies. It's not compiled for Xamarin though, so I don't believe that it works in Xamarin, but i'm not a Xamarin expert at all.

What is your scenario exactly? Why would you want to call the Media Services account directly from Xamarin anyways? You would only need to do that if you are creating a management application for the account Administrator. Otherwise, dont put Media Services directly into any client code! You should hide it in your middle-tier, and only pass Streaming URLs or SAS locators to the client application to upload content to.

For the upload from phone scenario, middle tier should create an Asset, get a writable SAS Locator for the Asset, hand that to the client side. Client can then use Azure Storage APIs to upload the content to that SAS URL directly (it ends up in an Azure storage container then.)

I believe that Xamarin has client side support for the Azure Storage APIs available.

Upvotes: 2

Related Questions