Breaking changes for Windows Azure Media Services .NET SDK GA

On Dec 14th 2012, we update our .NET SDK to 2.0.1.0 and you could download the latest SDK here. And starting from yesterday (Jan 14th, 2013), we drop the support for older version of .NET SDK, which we released in Preview. In another word, our server no longer recognizes some of your old APIs. If you find your older version of .NET SDK no longer works, don’t panic! Please read through this blog and see whether you could fix the code. 

If you still can’t find a clue, please bring your question to Windows Azure Media Services Forum and we will try our best to help you.

1. Create Asset

• You have to pass in an assetName for asset creation

Code in old API:

Code in current API:

The assetName here will show up in Windows Azure Media Services portal. So I guess you may have a more user-friendly name than mine to be able to manage your assets more efficiently.

Note: Assets.CreateEmptyAsset is deprecated.

• Adding concept of  IAssetFiles under IAsset. 

A new concept is introduced from the GA version. If you want to upload a video file (your AssetFile), you associate it with an asset. And upload your AssetFile to the portal, Here is the code:

singleFilePath is where you put your files in.

Here is the whole process for getting your asset usable for a job (Credit to George Trifonov):

  1. Create asset
  2. Create file object(s) associated with asset
  3. Create assess policy and locator so you can upload files from local filesystem in next step
  4. Upload files from local disk to corresponding asset files objects
  5. Select which file will a primary file within an asset

Code sample:

2. MediaProcessor Naming change

There are naming string changes when you query Media Processor. In the old API, if you want to query “MP4 to Smooth Streams Task” media processor, you are probably doing this:

But in the current APIs, this won’t work cause “MP4 to Smooth Streams Task” is no longer valid. You could query by following name and ID identifiers.

Media Processor Version GUID
Storage Decryption 1.5.3 aec03716-7c5e-4f68-b592-f4850eba9f10
Windows Azure Media Encoder 2.2.0.0 70bdc2c3-ebf4-42a9-8542-5afc1e55d217
Windows Azure Media Packager 2.2.0.0 a2f9afe9-7146-4882-a5f7-da4a85e06a93
Windows Azure Media Encryptor 2.2.0.0 38a620d8-b8dc-4e39-bb2e-7d589587232b

* We also add in more Task Preset and you could click on different Media Processor name above to check out more information on MSDN.

Here is the code if you want to “Convert Mp4 into Smooth Streaming“:

3. Upload/download progress for asset 

Assets don’t deal with uploading/downloading; only IAssetFiles do. If you are tracking the uploading/downloading progress of your video asset, you were using the following in old APIs:

And you should change to the following:

4. Using Windows Azure portal to diagnostic your problem

Since a few weeks ago, our Media Services on Windows Azure portal added a Job tab. And that’s where you could have a more detailed view of your job running progress. Meanwhile, you could also report to use the nid to let us help you find out the prob (by posting on our forum is the best way to reach out to us).

Job Progress Tab for Windows Azure Media Services

Lastly, please always refer to our updated MSDN documentation. You could find complete working sample with current SDKs. Good luck!

Update: you could find out more information here [MSDN forum link]

Changes since November 2012 (2.0.0.0) release

SDK Changes: The following changes describe fixes that are included in the December 2012 (Version 2.0.1.0) SDK.

Assets

  • • IAsset.Locators.Count : This count is now correctly reported on new IAsset interfaces after all locators have been deleted.

IAssetFile

  • • IAssetFile.ContentFileSize : This value is now properly set after an upload by IAssetFile.Upload(filepath).
  • • IAssetFile.ContentFileSize : This property can now be set when creating an asset file. It was previously read-only.
  • • IAssetFile.Upload(filepath) : Fixed an issue where this synchronous upload method was throwing the following error when uploading multiple files to the asset. The error was “Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.”
  • • IAssetFile.UploadAsync() : Fixed an issue where no more than 5 files could be uploaded simultaneously.
  • • IAssetFile.UploadProgressChanged : This event is now provided by the SDK.
  • • IAssetFile.DownloadAsync(string, BlobTransferClient, ILocator, CancellationToken): This overload is now provided.
  • • IAssetFile.DownloadAsync : Fixed an issue where no more that 5 files could be downloaded simultaneously.
  • • IAssetFile.Delete : Fixed an issue where calling delete may throw an exception if no file was uploaded for the IAssetFile.

Jobs

  • Jobs : Fixed an issue where chaining a “MP4 to Smooth Streams task” with a “PlayReady Protection Task” using a job template would not create any tasks at all.

Utility Classes

  • • EncryptionUtils.GetCertificateFromStore() : This method no longer throws a null reference exception due to a failures finding the certificate based on certificate configuration issues.

General SDK Updates

  • • Intellisense : Added missing Intellisense documentation for many types.
  • • Microsoft.Practices.TransientFaultHandling.Core : Fixed an issue where the SDK still had a dependancy to an old version of this assembly.

Changes since June 2012 release

SDK Changes

The following changes require any code written against the June 2012 Preview release to be modified:

Assets

IAsset.Create(assetName) is the ONLY asset creation function.  IAsset.Create no longer uploads files as part of the method call.

The IAsset.Publish method and the AssetState.Publish enumeration value have been removed from the Services SDK.  Any code that relies on this value must be re-written.

FileInfo

This class has been removed and replaced by IAssetFile.  See below.

IAssetFiles

Replaces FileInfo and has a different behavior. To use it, instantiate the IAssetFiles object, followed by a file upload either using the Media Services SDK or the Windows Azure Storage SDK. The following IAssetFile.Upload overloads can be used:

  •        IAssetFile.Upload(filePath).  Synchronous method.  Blocks the thread and is recommended only when uploading a single file.
  •        IAssetFile.UploadAsync(filePath, blobTransferClient, locator, cancellationToken).  Asynchronous method.  This is the preferred upload mechanism. Known bug: using the cancellationToken will indeed cancel the upload; however, the cancellation state of the tasks can be any of a number of states. You must properly catch and handle exceptions.

Locators

The Origin-specific and Windows Azure CDN-specific versions have been removed. The SAS-specific context.Locators.CreateSasLocator(asset, accessPolicy) will be marked deprecated, or removed by GA. See the Locators section under New Functionality for updated behavior.

New Functionality

The following functionality is new in the November 2012 (2.0.0.0) release.

Deleting entities

IAsset, IAssetFile, ILocator, IAccessPolicy, IContentKey objects are now deleted at the object level, i.e. IObject.Delete(), instead of requiring a delete in the Collection, that is cloudMediaContext.ObjCollection.Delete(objInstance).

Locators

Locators must now be created using the CreateLocator method and use the LocatorType.SAS or LocatorType.OnDemandOrigin enum values as an argument for the specific type of locator you want to create.

New properties were added to Locators to make it easier to obtain usable URIs for your content. This redesign of Locators was meant to provide more flexibility for future third-party extensibility and increase ease-of-use for media client applications.

Asynchronous Method Support

Asynchronous support has been added to all methods.

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">