February 12, 2008

Media Center Add-In for updating Facebook Status

I was at TechEd EMEA in Barcelona for the first time in 2007. Although I've been lately working a lot with MOSS 2007, I tried not to go on too many MOSS sessions. Instead I enjoyed some excellent MS Robotics Studio, Silverlight, XNA, Media Center sessions.

On the Media Center session I learned how to make simple add-ins to the new Media Center that comes with Vista. Of course, it all seems so easy when you're looking at a practiced session. In practice there were several issues I ran into.

Nevertheless, here it is: a Vista Media Center Background add-in that updates your Facebook user status according to what you're watching/listening on Media Center. So, if you're watching a program called "News" on Media Center, soon your Facebook status will say "...is watching News". In the same way the DVD, Recorded TV and Video title is shown. If you're watching pictures status will just be "...is watching pictures". When listening to music status will be "...is listening to ARTIST - TITLE".

Add-in checks Media Center MediaState every 10 seconds and only connects to Facebook and changes the status if change in MediaState is detected. It also handles the Extended Permissions situation as users need to give the application permissions to update user status. Add-in uses Facebook.NET libraries for most of the Facebook related operations.

Extenders are not currently supported since Facebook login must be done using a specific URL and even if I would create a separate Add-In to take care of the login (instead of using Windows Forms) I couldn't have any browser control in that add-in (in MCML). This thing is subject to change as I investigate the other ways to accomplish this.

Please give it a try and let me know what you think. If you have questions and/or problems, please post them in Facebook so that they'll be in one place.

  • Vista Home Premium or Ultimate
  • .NET Framework 2.0

Quick instructions
  1. Install using setup.msi, restart is required
  2. Start Media Center
  3. Separate Windows Forms window is opened where you must login to Facebook.
  4. If this is the first time running the add-in a notification is shown that you have to give the Extended Status update permissions
  5. Extended permissions Windows Forms window is shown. Grant the permission, and close the form.
  6. Add-in runs in background updating your Facebook status.
Later when Media Center is started, only Facebook login is required (if you haven't checked the persistent login checkbox).

Facebook application page is here. See the front page of my blog for latest version information of the AddIn.


  1. Does this work on Media Center Extenders too? If so, my wife is going to be very excited.

  2. Currently Extenders are not supported. I believe it might be possible to do the Facebook login in Extender, but I have to investigate what would be the easiest way. Another question is how the Media Status Aggregation Service works with Extenders.

  3. Pretty darn cool. :-)

  4. Hello,
    Great addon!
    I investigating to build a simular one: I want to write an addon to put MCE status info in an xml file each 10 seconds. That xml would be picked up by an other tool that puts the status info on my velbus display (www.velbus.be).
    I want it to display the currunt song/movie/life tv channel info.

    I'm planning to create this tool an put it freely available for anyone at the Velleman forum.

    Can I use your code as a start? That would be very helpfull ;-)
    I'm programming C#.
    Hope you can put me in the right direction ... Thanks a lot!


  5. Thanks for you interest in my application.

    What if I add a configurable settings to my tool where you can enable/disable the XML status and also define the folder location of the XML file?

    I spent quite some time getting the Media Status part work and I believe there are not that many different ways of getting the Media Status working, so your code would pretty much be a copy&paste of mine.

    I understand your urge to create an own application, but if you're comfortable with just using my application, we would have the program code in one application. This would be good in terms of bug fixes, feature additions, etc.

    What do you think?

  6. Well, it turns out that we had a 45 mins car drive and my wife kindly offered to drive so that I could implement the XML status feature.

    So here it is, I haven't extensively tested it, but it works on my laptop, thus the beta status: http://www.kolumbus.fi/jussi.palo/FBMCE/setup_0.3.0.0_beta.msi

    Few words on how to enable XML logging. Everything is configured in the registry (HKLM\Software\HamarData\FBMCE or in the VirtualStore hive if you're using UAC). You need to have the following registry values (all are REG_SZ types) for the application to only log to XML and not to Facebook:

    "EventsEnabled_Service_Facebook": "0"

    "EventsEnabled_Service_Xml": "1"

    "Service_Xml_File": "c:\temp\status.xml" (or anywhere you like)

    Let me know how it works for you.

  7. Hello again,

    Very kind of you to add the xml feature to your add-on. I really appriceate this!
    I will try it right away and let you know my findings.

    Thanks a lot!

  8. hello Jussi,

    I installed the addon, but do not see an xml file.

    In regedit I can see that the appropiate keys are present and filled in correctly, but no xml ...
    The folder where the xml should be created (c:\temp) has write rights for all users.
    Also, if I put EventsEnabled_Service_Facebook to "0" I still have to login to facebook when MCE is launched. Is this normal behaviour?
    Any hints to solve my issues? Thanks! You can also contact me by mail: gert at stogo dot net

  9. True, the Facebook login is shown even if that setting is set to 0, I will fix that ASAP. No status change is done to Facebook, though.

    Do you have UAC enabled? If yes, then the registry keys you have to change are in HCR/VirtualStore/... If UAC is disabled they'll be in HKLM/Software/HamarData/FBMCE.

    Also you could verify that the application works in general. Please set the "Debug" key in registry to 1. Then you should see notification in Media Center when the tool would be changing status. All registry key changes (except Facebook login related hashes) are read dynamically, so you don't have to restart Media Center after changing the values.

  10. Hi Jussi,

    Indeed I have UAC on - I was not aware that this changes registry behaviour. However I turned it off now and it still does not work. When setting debug to 1 I don't see any popups in MCE. It keeps asking for the facebook login even when I ask to save my changes ... seems like a rights issue, no?
    I hope you can help ...

  11. I did some testing with UAC enabled, and it in itself should not affect the application.

    The issue is now in the Media State Aggregation service (as the Debug isn't outputting any status changes). Could please uninstall the tool and re-install it. When installing, please do it as an Administrator (right-click on the setup file and Run as administrator). This should set the Media State registry keys in the correct location. Finally reboot once more.

    If it still doesn't work, can you send me a screenshot of your FBMCE registry hive (jussi dot palo at gmail).

    I'm in a work related training this whole week so I'm unable to work with the program code, but don't worry, we'll get it working :)

  12. I tried the latest version on Vista SP1 Home Premium and it kept throwing errors at me....is there an update for SP1?

  13. I'm using it on SP1 Ultimate without issues. Do you have the latest version ( downloaded from Facebook)?

    Can you send the error messages you're seeing and I can have a look at them.

    Thanks for reporting this issue!

  14. im getting the following error on sp1 ultimate ed.

    unable to launch
    system.unauthorizedAccessException: Access to registry key 'hkey_LOCAL_MACHINE\SOFTWARE\HamarData\FBMCE' is denied

    at microsfot.win32.registryKey.Win32Error(Int32 errorCode, String str)

  15. Can you try to see with RegEdit if the HKLM\SOFTWARE\HamarData\FBMCE exists at all?

    If not, try reinstalling by running the setup with elevated privileges.

  16. any chance this is/will be available for windows xp?

  17. I agree you would get more coverage of your great app if it was available to XP

  18. Ok, the summer is coming and I might have some time to create an MCE 2005 version of this.

    No promises, but looking at MCE 2005 development documentation, I see no reason why this couldn't be done on XP as well.

    Also regarding the Extender support, it is now sure that it is impossible to do it at least on MCE 2005 (http://support.microsoft.com/kb/921276).

  19. I am curious about this plug in. I have wanted to do this for a long time so I am one step closer now that I have a computer with Vista Ultimate...BUT..this is what I want to do. I want to show that artist-track in my facebook status using windows media player 11 instead of using windows media center. I dont use wmc but I am always listening to music on WMP11. Any ideas for this? if it is available, can you direct me to directions? If it isnt available, how hard would it be for a good coder to make it?

  20. Yes, this is very possible. See http://msdn.microsoft.com/en-us/library/aa393418(VS.85).aspx for information on how to create plugin for WMP. It even mentions on that page "A typical UI plug-in might allow a user to buy the CD that contains the currently playing track ..." (appears to require C++).

    For Facebook part I suggest using either Facebook.NET or FacebookToolkit. C# can be used.

    I'm using the latter as it seems to be still maintained and developed further.