Building a Vista Media Center plugin

All I want to do is watch hulu.com movies on my TV instead of my laptop. This is much easier said than done though. The development tools seem to have stalled a few years ago. Is anyone else writing these things these days?

This post gives bad news: Flash is not coming to MCE anytime soon. So in order to get the Flash videos playing you have to render the ordinary Flash object inside a page, and have the plugin navigate to that page.

First off, I’m not the only one doing this. TunerFreeMCE, a closed-source plugin written by the author of the blog above, does the same thing for BBC shows and Hulu. Unfortunately it seems broken at the moment for Hulu content, but that’s probably easily fixed. Perhaps they changed their HTML format or something.

Main things I learned in the writing of my first plugin:

The Media Center SDK version 5.3 (which I think is the latest) has some issues.

  1. It contains a solution (MCMLSampler) that doesn’t build in VS 2008. It can’t find any of the MediaCenter DLL references, and try as I might I couldn’t add them manually either. So you can use the solution to browse the code but you can’t build it.
  2. There are hardcoded WiX binary paths in the MSI build batch file Build.bat. Sloppy, Redmond!
  3. Don’t forget to edit DevInstall.cmd if you add any non-DLL’s to your plugin; otherwise they won’t get copied to Program Files.
  4. DevInstall.cmd /u /debug works but DevInstall.cmd /debug /u does not.

The design and debugging process leaves a lot to be desired.

  1. I haven’t found any way to F5-debug the application directly. I can install the plugin into MCE via DevInstall.cmd (which installs it into the GAC) and then attach to the process but that’s it. If you set the registry key in C:\Program Files\Microsoft SDKs\Windows Media Center\v5.0\Tools you end up spawning a dialog window upon launch to give time to attach to the process. This post recommends a macro to make it quicker but I haven’t tried it.
  2. You can debug your markup via F5-debug but it will crash if you have any code-behind dependencies. This makes it fairly useless IMHO.
  3. There’s no visual designer (at least that I’ve found). So you have to lay out the markup manually, like in the early WPF days. And when you don’t have any good-looking templates to start from, the results look like crap.
  4. I did find the MCMLookalike project to develop open-source templates plugin developers could use to better match the MCE UI. It ceased last year due to a lack of community support but it was really helpful to see how a good MCE developer would write the MCML. You have to dig for the source code, but it’s there. I had to rebuild the VS 2008 project to get it running; that’s available here: mcmlookalike-vs2008.zip
  5. You can set several command-line options in MCMLPad during debugging. I added screen resolution, for example, so in the “Command-line arguments” under the Debug tab, I have the following to test 1280×720 (what the default “windowed”) launch of MCE is on Vista):
  6. -load:"resx://HuluMCE/HuluMCE.Resources/Test" -assemblyredirect:"C:\shared\projects\hulu\HuluMCE\bin\Debug" -markupredirect:"resx://HuluMCE/HuluMCE.Resources/,file://C:\shared\projects\hulu\HuluMCE\Markup\,.mcml" -size:1280,720
    

When I get a bit further along I’ll post the code, and built project, so you can see it in action.