Sunday, 17 October 2010

Writing a Media Center Application in Visual Studio 2010

Rocky River, Kangaroo IslandMy ISP (Internode) provides a number of unmetered streaming radio stations for its customers. A while back I'd followed some instructions on how to set up shortcuts in Media Center to link to some of these stations. This worked pretty well, until the ISP reorganised their server and all of the shortcuts broke. I thought it would be an interesting exercise to write a simple Media Center application that could grab the current radio list from the published radio stream RSS feed, list those stations in Media Center and allow selecting a station and getting Media Center to start playing it.

  1. Download and install the Windows 7 Media Center SDK. This install some samples, the SDK help file and some templates (but only for Visual Studio 2008).
  2. Go to Charlie Owen's blog and download his Addendum.zip. Amongst other things, this contains both project and item templates suitable for Visual Studio 2010. Follow the instructions to copy the templates into your Visual Studio templates folder.
  3. Download and install the latest WiX 3.5 build (WiX 3.5 includes support for 2010)

Now you can start Visual Studio and you'll see a new project template in the C# language section. There's a few more things I needed to update to get everything working properly:

  • Search for "Microsoft SDKs\Windows\v6.0A" and replace it with "Microsoft SDKs\Windows\v7.0A" (eg. devinstall.cmd)
  • Search for "Windows Installer XML v3\bin" and replace it with "Windows Installer XML v3.5\bin" (eg. build.cmd)

Then it's just a matter of getting up to speed with the intricacies of Media Center application writing!

The source code for the application (InternodeRadioMCE) is published on Google Code. It is very rough at the moment. As I get more familiar with the Media Center programming model I hope to improve it a bit!

And the photo? It's of Rocky River (courtesy of our recent holiday to Kangaroo Island) – and the closest thing I could think of to a stream (as in streaming radio!)

2 comments:

Anonymous said...

Sound, this worked a treat. Thanks a lot =)

mattyboy said...

Thanks for this - it's a helpful start.

So when I compile your code the output is an msi which installs it.

Does F5 debugging work for Media Center plugins? When I debug your code I get the Preview Tool popup, with 4 "Button Test", but not the radio stations, and it doesn't seem to hit any of my breakpoints.

-Matt