Mobile Recording for Media Center Edition PCs

http://www.brains-N-brawn.com/mobileRecord 9/15/2006 casey chesnut



had already submitted a RobotInvaders contest entry with /speechTextAdv. thought it was interesting because it showed how a dialog based app could be exposed with both a speech and instant messaging interface. but i didn't find the actual app idea to be very useful ... so i started brainstorming. during this time i got stuck in traffic and was not able to get in time for a national geographic special i wanted to see, but failed to schedule to record earlier. and although i've got MSN Remote Record installed on my MCE machine, there was no way for me to access it from my car. so that became my problem ... scheduling recordings on an MCE PC from a mobile device. since i just purchased a Moto Q, i decided to target it running MSN Messenger Mobile (Messenger on a desktop works too). and since i've been been working with the Speech Server 2007 beta, i also made a speech interface, so that you can schedule a TV recording using your voice from any phone ... granted Speech Server 2007 has been delayed until later next year :( because of this, the article will concentrate on the instant messaging piece.



there are 4 components to the /mobileRecord service


  1. labs.Zap2it.com - where TV guide data is downloaded from.
  2. /mobileRecord client application - this will be setup and running on your MCE PC. it downloads guide data daily and listens for recording requests from the /mobileRecord messenger bot.
  3. /mobileRecord messenger bot - this is a bot that is always signed into the MSN Messenger service. it's address is MobileRecordBot@hotmail.com. it will access the /mobileRecord client app running on your MCE PC to retrive guide data, and will submit recording requests to it as well.
  4. any Messenger instant messaging client - this is how you will interact with the /mobileRecord messenger bot to schedule a recording. it might be Windows Live Messenger on a desktop, or MSN Mobile on a Smartphone or PocketPC. NOTE since MSN Messenger now works with Yahoo Messenger ... it should just be a matter of time until Yahoo Messenger clients can communicate with MSN bots too. right now, the bots still appear offline to yahoo users. this limitation might just be because of the bot provider that i'm using?

Demo Mode

if you just want to try out a demo of the bot without installing the client or registering at Zap2It, then just add the bots IM address (MobileRecordBot@hotmail.com) to MSN Messenger and start chatting with it. it won't have recent TV guide data, nor will it let you actually schedule a recording ... but it will let you get a feel for how the bot works, so you can determine if you want to actually install it and get it setup.


you must follow the setup steps below before you can use the service.

  1. install the /mobileRecord client application on your Media Center Edition 2005 PC (mobileRecordMceClientInstaller.msi). this client application will download the TV guide data and listen for recording requests. it installs to c:\program files\brains-N-brawn\mobileRecord MCE Client\. it also adds a shortcut to the 'startup folder'.
  2. register for a free Zap2it account at labs.zap2it.com (use the following certificate code : ZYZM-TE5O-SBUT). this is how the client gets its guide data, because the MCE EULA does not allow developers to use the guide data that MCE PC already has (lame). because of this limitation, the application will only work for USA and Canadian MCE owners. also, this service is meant for last-minute recordings, so it only downloads 3 days of upcoming TV guide data. NOTE you will have to renew your zap2it subscription every 3 months by completing a survey. MS ... please allow developers to use the guide data that MCE already has!
  3. open up a port on your firewall and/or router. the client has to listen for incoming record requests. please visit PortFoward.com if you need assistance.
  4. specify the MSN Messenger account that you will use to schedule recordings, and a (one-time use) pin # to associate that messenger account with your MCE PC.
  5. click the 'Test and Save Settings' button on the client. this will save your settings, download the latest guide data, and register the client application with the /mobileRecord messenger bot. if you have any problems with the client, it will write exceptions to its install directory in a file called 'mobileRecord.txt'

the setup screen of the client application is pictured below.


when you close the client, it will remain running in your system tray. the client must be running when you want to schedule a recording. the client will attempt to download new TV guide data once every day at 2 AM in the morning.


it works by using a Messenger instant messaging bot, so all you need access to is a Messenger client, which could be on your PC, PocketPC, or SmartPhone. the bots address is MobileRecordBot@hotmail.com ... just add it to your contacts list.

the bot allows you to search for a specific program, browse tv listings, or manually schedule a recording.

if the program is a series, then you are prompted if you want to record the entire series.

if there is a recording conflict, then you are asked if you want to override that conflict.

when you are searching or browsing, you can click an Activity window link to open an Activity window that links to MSN TV for more information about the show (NOTE there is no Activity window support in MSN Mobile).


when a recording is schedule, it is anonymously posted to the bots MSN Space : http://mobilerecordbot.spaces.live.com/. this allows you to see what other people are recording that might interest you and introduce you to new shows you might otherwise miss.


the following diagram shows the basic dialogs that can take place through the instant messaging interface.


the Speech Server implementation has less features because browsing TV listings on a  phone is not fun. but you can still search my show title or actor's name, and it also supports manual recordings.


these are some its limitations :


Usage and Troubleshooting

after successful installation, you can begin using the service

if you get stuck, then you can type 'menu' or 'quit' at anytime to start over.


this is the 2nd app that i created with both a speech and instant messaging interface. previously, i wrote the speech implementation first, and then just created an IM-to-speech bridge that wrapped the speech implementation. that worked pretty well but had limited deployment options. also, instant messaging supported some features that speech did not (e.g. nudges/winks/activity windows). this time, i wanted to do something different, and decided to create custom workflow activities specifically for instant messaging (pictured below). although the GoToActivity is pictured, it is not actually implemented. this is the one activity that i really wish was part of the generic Workflow activities. SpeechServer provides a GoToActivity which makes controlling dialog flow really easy, but they accomplish this by providing a custom WorkflowActivity. finally, i created the interfaces for Nudge, Wink, and an ActivityWindow activity ... but did not implement them yet. mainly because this app is targeting MSN mobile on mobile devices that do not support those features.


the core activities are QaActivity and StatementActivity. these 2 map to to the QuestionAnswer and Statement activites which are the core of the workflow dev model for Speech Server 2007. the designer for the QaActivity is pictured below. it provides a TurnStarting event which allows you to initialize a prompt and a grammar. then it goes into a continuous loop that prompts the user and waits for an answer from the user. it will kick out of the loop as soon as the user enters a valid answer. if the user enters an invalid answer, then the next prompt can provide a more detailed message about what is expected from the user. this looping mechanism also supports paging through lists of data.


this provides a framework that allows me to rapidly develop instant messaging applications. at this point, it pretty much just involves dragging the IM activities onto a new workflow design surface and writing the custom code in the code-behind specific to each IM bot application. the only other feature i really missed from SpeechServer was the concept of Commands. to provide similar functionality, i just baked 'commands' into the router. so if you type 'help' then the message never makes its way to the workflow instance; instead the router intercepts in and returns a generic help message. pictured below is a fragment of the workflow designer surface for the /mobileRecord Messenger Bot. can't tell you how much i'm liking the Workflow Foundation. there were a couple of times in which i dramatically changed the flow of the dialog, and most of those changes were accomplished just by reordering the activities on the designer!


Messenger Samples

the following document is a transcript from a Messenger session : transcript.rtf

this video shows how to search for a show to record using Live Messenger on a desktop


this video is browsing for a show to record using MSN Mobile on a Motorola Q


manually scheduling a recording using Live Messenger on a desktop


seeing what shows are already scheduled to be recorded using MSN Mobile on Moto Q


the client application that is installed on your MCE PC


Speech Server 2007

the 2 audio samples below are from the Speech Server 2007 implementation, that allows you to schedule a recording from any telephone.




that explains the /mobileRecord app. developing it, i really began to see the power of Workflow Foundation. there were multiple times when i changed the flow of the application, and it ended up just being a drag-and-drop in the designer. not to mention the improved visibility ... WF just makes it ridiculous easy to see program flow. for MediaCenter, i really wish that they would allow developers at least some access to the guide data. MCE already has the guide data ... i shouldn't have to download it again. ClickToRecord provided most of the functionality i needed, but i'm really glad to see that it provides even more flexibility in Vista. i'm also hoping that the MSN TV / Remote Record guys start to open up more of their web functionality. really would have liked to use MSN TV to provide more detailed information about a show than what Zap2It provides, as well as allow a user to record a show using RemoteRecord from the bots MSN Space. i'm using Incesoft as my bot provider, and really like the simplicity of their API. they've gotten alot better with reliability and it just keeps working. just wish they would provide a little more functionality in the free version, that they do provide in the enterprise version. but ultimately i hope that the Messenger SDK evolves to the point where the functionality of the /mobileRecord client could be handled by a Messenger Add-in hosted in Live Messenger. then it could just use Messenger to provide authentication, hosting, communication, etc... Thanks to MS for running the RobotInvaders contest ... this was alot of fun

testing the bot, i've really become partial to the instant messaging interface for Windows Mobile devices. especially with the thumb board on devices like the Motorola Q and Cingular 8125. i actually prefer the minimalist IM interface over a mobile web page. so i really think MSN bots make alot of sense for MSN Mobile. but i also really started to like it on the desktop too. granted, i'm already a minimalist at heart ...

i am upset that Speech Server 2007 isn't going to come out for a while, because i consider this app being accessible on any phone using your voice to be the end game. that gives MediaCenter PC users the ability to record a show anywhere/anytime. i've actually got that code all written (see audio samples above) ... just waiting to deploy


sorry, i'm keeping the source code for this one, but here is the code for the custom workflow activities along with a (simple) sample bot showing how to use the activities in a workflow. NOTE you'll need to sign up for a bot account with Incesoft, and change the SPID and password in the source code (Form1.cs).

this architecture let me quickly add features to the /mobileRecord bot. the final stats were 20 Statements, 24 QuestionAnswers, 22 IfElse, 48 IfElseBranches, 28 Conditions, 11 Code, 5 Typing, and 2 Activity windows.


11/28/06 - added source code for instant messaging Workflow Activities and a sample bot application

there are a # of things that could be incorporated in a future release :


probably going to mess around with WPF some more. later