Streaming Content using Azure Media Services to a Windows Universal App

I have been dabbling at the intersection of Windows Universal apps and Azure Media Services.

I uploaded a video file that I produced using Camtasia Studio. I encoded it as H264 Adaptive Bitrate MP4 1080p output. The final video was about 6GB in size.

So I found a few great resources and was able to piece it together. Many of the demos and samples I found were partially broken. I chalk this up to the rapidly changing Windows ecosystem.

The player framework. http://playerframework.codeplex.com/

After going into ‘release’ mode. I was able to get the following error from the MediaFailed event.

MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT – 0xC00D2EE2

After some tinkering in the Azure Portal I noticed that I didn’t have any Streaming Units. It seemed logical that I would be unable to stream video if there were streaming units. So I went out to Azure and scaled up a streaming server.

I still got the same error code. So I’m wondering if there’s an issue with the URL I am using. I go to the Azure portal and play it within the portal to verify it will stream. It doesn’t work in IE but it works in Chrome (go figure!). So I’m pretty confident that the video is good and in the right format. It should just be a matter of getting it to play in my Windows Universal app using the Player Framework. So I inspect element and check the URL on the video tag.

I notice the URL is different than the one I obtained from the Azure Portal so I plug that into my Windows app to see what happens. Maybe it will work? <fingersCrossed />

<fail> BUT, I do get a different error.

MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT – 0xC00D36C4

I read the error again and the way its phrased makes me feel like there is some extension or plugin missing, I don’t know why. So I search on the error code again and find this issue reported on the Player Framework Codeplex site. It was for the same error code (MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED : HRESULT – 0xC00D5212) but different HRESULT (0xC00D5212, whatever that means). I never got this exact error code. I was only able to ever get an HRESULT of 0xC00D36C4 and 0xC00D2EE2. Anyways, in this issue report, I find a big block of code where the original author is configuring their media player using the “MediaExtensionManager”. I notice that one of the file types they are registering is “.ism” which happens to be the same type that Azure Media Services output when it encoded the original video content that I uploaded! Could this be it?

So I cherry pick a couple lines of code and drop them into the constructor of my page.

MediaExtensionManager extensions = player.MediaExtensionManager;

extensions.RegisterByteStreamHandler("Microsoft.Media.AdaptiveStreaming.SmoothByteStreamHandler", ".ism", "application/vnd.ms-sstr+xml");

player.MediaExtensionManager = extensions;

I run my app, and guess what? It freaking works! Eureka!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s