How To Create your own Windows Phone 8.1 Project with HLS Support

Petri Louhelainen
3 min readOct 3, 2014

--

I was yet again involved in a project where I needed to implement HLS support for Windows Phone 8.1. Setting it up is currently quite tedious task and takes an hour to do from the scratch so here are my notes for the next time I need to do this. I also don’t want to make this easy to you by providing a ready repository for you to clone as it is important to understand what is happening here in order to add other libraries and modules later on.

Without further ado, let’s start by creating our own Universal Hub App.

Create your project first

Now that I have the project ready, I need to download Microsoft Player Framework 2.0 and install it as globally available library.

Once I have that, I can start adding dependencies.

Click Add Reference…

You should have all the Microsoft Player Framework libraries available. I you are not going to do ads or smooth streaming, the first one is all you need.

Add dependency

Now starts the tricky part. For now, you need to install PhoneSM directly from Git master, as the support for many of the windows phone 8.1 features have not been officially released in any package. I personally like to use Git subtree -feature as then I can easily pull all the changes from PhoneSM repository and update the sources locally.

https://gist.github.com/plouh/90438f9d42f38577f4ea.js

Read more about git subtree merging from git book.

Now we can start adding PhoneSM as a dependency also. Create a new Solution folder “PhoneSM” and start adding existing projects there.

Add Existing Projects…

You’ll need to add SM.Media, SM.Media.Builder, SM.TsParser, SM.Media.Web.HttpClientReader (this is not always necessary, include only if you need something else than native http), SM.Media.Platform.WinRT with optional SM.Media.MediaPlayer.WP81 and SM.Media.BackgroundAudio.WP81.

You should now have something resembling this in your solution.

Add references to PhoneSM projects

You are still far away from creating a compiling project. Let’s add the projects as references to the MyHlsProject.WindowsPhone project from the solution tab.

And compile with Ctrl+Alt+F7.

Uh oh…

Wassup? The first error seems to provide us with a clue. Let’s enable NuGet package restore from Solution ‘MyHlsProject’ context menu.

Select Enable NuGet Package Restore

To get nuget package restore work, there is one more trick. You must set package source in Package Manager Console to nuget.org.

Set package source to properly to nuget.org

Now you’ll have a compiling project. But one more thing — it’s still not linking. You need to add reference to Autofac in your own HLS project. This happens by selecting your main project as Default project and running Install-Package -command in the console.

Install Autofac

And now you should be able to compile and link your project successfully with another Ctrl+Alt+F7.

And enjoy your fresh windows phone 8.1 project with HLS support

Using the library with HLS support is left as an exercise.

--

--