Posts Tagged ‘Media Center’

Code based dialogs in media center

Wednesday, March 10th, 2010

I’ve written a few posts on how to implement dialog boxes in media center (Adding a version checker and Simpler popup dialog). They are both great examples of how to trigger a dialog box in mcml. Suppose though you want to do it all from within code, not within mcml. Why would you want to do that? Well, for one it means not having any AddIn calls in your mcml, and AddIn calls mean you can’t use the mcml preview tool – which significantly hampers development. For this example, I’m going to repeat the Adding a version checker example, but all in code.

So, to trigger a dialog from your code, the first thing you need to do is to build some buttons;

ArrayListDataSet dialogButtons = new ArrayListDataSet();
dialogButtons.Add("Download Now");
dialogButtons.Add("Remind me later");
dialogButtons.Add("Ignore");

This adds 3 buttons to the dialog. Obviously add as many or as few as you like. The next thing you need to do is to add the call to open the dialog;

String dialogText="There is a new version available";
String dialogTitle="New Version";
Microsoft.MediaCenter.Hosting.AddInHost.Current
.MediaCenterEnvironment.Dialog(dialogText
, "dialogTitle, dialogButtons, 30, true, null
, new Microsoft.MediaCenter.DialogClosedCallback(versionCallback));

This will open a dialog as a modal dialog with a timeout of 30 seconds. When it is closed, the method?versionCallback will be called, so now we need to write that method;

public void versionCallback(Microsoft.MediaCenter.DialogResult result)
{
    if (result.ToString() == "100")
    {
        InstallNewVersion();
    }
    if (result.ToString() == "101")
    {
        RemindLater();
    }
    if (result.ToString() == "102")
    {
        IgnoreNewVersion();
    }
}

And obviously fill in the appropriate actions for each method.

Finally, you may want to block this dialog from triggering when you are in the debugger (since it won’t work), so put an if statement round it to stop it running in debug mode;

#if(!DEBUG)
   String dialogText="There is a new version available";
   String dialogTitle="New Version";
   Microsoft.MediaCenter.Hosting.AddInHost.Current
.MediaCenterEnvironment.Dialog(dialogText
  , "dialogTitle, dialogButtons, 30, true, null
  , new Microsoft.MediaCenter.DialogClosedCallback(versionCallback));
#endif

And that’s it – an mcml dialog operated entirely from your code.

Flash in Media Center

Monday, November 30th, 2009

Microsoft?made use of Flash in Media Center for it’s integration with MSN Player. That was a startling announcement one month ago since it was assumed that Microsoft wanted to promote Silverlight over Flash, and would never allow Flash in Media Center. So, in the past month what has happened about that??Unfortunately?it seems to have moved backwards again. First of all, the UK integration with MSN Player has?disappeared, only to be replaced by the Sky subscription service. I think that is a major mistake by Microsoft, because I don’t think anyone will pay for a very cut down version of Sky on their PC, and it would have been better to have a working internet TV solution available.

Secondly, I have been trying to find out how independent developers such as myself can make use of Flash in Media Center. A friend of a friend managed to get this unofficial response;

As far as I know, the Platform/APIs are only available for internal use. We don?t have any plan to release public documentation on that at this moment.

So that means that until Microsoft change their minds or someone manages to?dissect?the?delivered?code to work out how to use the libraries in an unsupported way, we are stuck without Flash support for independent developer.

BBC iPlayer on the Xbox

Monday, November 30th, 2009

bbx_xboxThere was an interesting article in The Telegraph over the weekend which claimed that the BBC will not be bringing the iPlayer to the Xbox 360, unlike the PS3 and Wii which already have excellent integration. It is claimed that this is because Microsoft are demanding that it only be made available to Xbox Gold subscribers, and the BBC are saying that that is unreasonable. As you will see from my post about Sky integration, I’m really down on requiring Xbox gold membership to access services like that. Gold membership should be about getting you access to servers that run online gaming. It should not be about bringing you access to third party software that is free elsewhere. Well done BBC for sticking up to Microsoft, and I hope Sky see sense too.

Of course if you want to watch iPlayer on the Xbox 360, just install TunerFreeMCE on your PC and access it via Media Center. The latest version of TunerFreeMCE includes wmv streaming of BBC programs, so works great on extenders like the Xbox 360 too.

Sky and Flash in media center

Thursday, October 22nd, 2009

With the public release of Windows 7, there have been some interesting developments;

1) Here in the UK, the Internet TV Beta 2 link has?disappeared?from our menus. I suspect that is because it was really buggy (I often got errors that my video library was unavailable). Hopefully it just means that a new better version is on the way

2) An advert for Sky Player has appeared in the menus;
sky

(more…)

Auto Play DVDs in Media Center in Windows 7

Monday, September 7th, 2009

autoplay7

One of my great annoyances with Windows 7 is that you don’t have the option to auto-play DVDs with Media Center. I logged it as a bug during the testing phase, and was informed that it was intentional – something along the lines of if you wanted to use Media Center, it would be open already, so auto-play wasn’t appropriate.

Anyway, I disagree, and fortunatly someone has come up with a fix for the problem. Mikinho over at Seven Forums has produced a simple registry change to get Media Center added to the DVD movie auto play options. I tested it out, and it all works great; (more…)

WebTelek Media Center Add-In

Sunday, June 28th, 2009

WebTelekSome of you might have noticed that there hasn’t been much going on with TunerFree for a few months. I can now reveal why that was. For the past 2 months I have been working with Russian internet television provider, WebTelek, on a Media Center interface. WebTelek specialize in providing television and radio programs over the internet for the Russian market, both at home and abroad with the ex-pat market. Today they have Live TV from almost 70 channels, 20 days complete coverage of Catchup TV for over 50 of those channels, and thousands of movies, with growing content all of the time.

WebTelek approached me with the request to create a top of the range Media Center interface for their internet television service. They already had a web interface and a Media Portal interface, but wanted to expand in to Media Center. One of their biggest concerns was that it look great so that they could confidently have a superior interface to their competitors. That was a challenge that I was happy to take on, especially with the prospect of developing new library components that I could use in TunerFree.

I won’t be publishing the full code for this project for obvious reasons, but wanted to share some of the key things I learnt from this project.

(more…)

Wanted: Plugin developers for TunerFreeMCE

Tuesday, June 9th, 2009

I am currently working on a plugin feature for?TunerFreeMCE to allow other people to produce plugins for TV content from any source. The idea is that you specify some metadata about the channels (e.g. channel names, logos, details of how to get the program list), and the TunerFree code takes care of reading it and producing a list of programs.

At the moment I am looking for people who would like to work on a plugin to test this. Ideally you need;

1) A channel that you want to add
2) html and xml skills to be able to produce the metadata

If you are interested in producing a plugin, e-mail me at martin@milliesoft.co.uk

Thanks

Martin

Simpler popup dialog

Sunday, April 19th, 2009

In a previous post on adding a version checker to media center, I gave an example of how to write a popup dialog box for media center. There is also a simpler version of the Dialog if you don’t need to know anything about the response, e.g. if you are simply showing an information message. This simpler version doesn’t require a callback to be defined, or any complex button definitions. It just needs a title, some text, a button name, a timeout and whether or not it is modal. Here’s an example;

      <Condition Source="[Preferences.TwitDialog]" SourceValue="true" ConditionOp="ChangedTo">
        <Actions>
          <Set Target="[Preferences.TwitDialog]" Value="false"/>
          <Invoke Target="[AddInHost.MediaCenterEnvironment.Dialog]"
                  caption="Authorize Twitter"
                  text="Please authorize twitter."
                  buttons="Ok"
                  timeout="15"
                  isModal="true"/>

        </Actions>
      </Condition>

The buttons can only be ones from the list described in the documentation. A modal window requires either the user or a timeout to close it before any other actions can be done, whereas a modeless window allows the user to continue with other things in the meanwhile.

The dialog is fired in this example by a property which is set in the code to true, and then set back to false when it is read. The condition only fires when the value is set to true in the first place by using the ConditionOp.

Front End and Back End Synchronization in MCML

Sunday, April 19th, 2009

One of the issues that has been hardest for me to learn with developing media center applications as been the linking of front end items in the MCML layer with data that I have in c# on the back end. For a long time I struggled with binding values from the code in to front end, and making method calls from the front end in to the back end. I suspect that the reason I did this was because that is how it is shown in the Media Center SDK and documentation, so I thought it was the only way.

It turns out that the SDK is in fact showing the most complicated use case. There is a much easier way of linking the front end and the back end, that is so simple compared to the rest of MCML development that it’s almost non-intuitive. The technique is to create a UI item in your C# code, and then refer to that item on the front end. You don’t have two items, one front end and one back end. Instead you simply have one item that is referenced in both layers. That means that when you make a change to the value of the item in your C# code, the change is instantly reflected in the UI, and when you make a change to the value of the item in the UI, the C# code can reference that value instantly. Because it is the same physical item in memory. (more…)

Hear me on The Media Center Show this week

Friday, April 10th, 2009

I did an interview with Ian Dixon over a month ago about TunerFreeMCE, which is in this week’s Media Center Show. The content is hopefully a great advert for TunerFreeMCE, but it is bit out of date now, in that it talks about needing mouse clicks in some places, which is no longer neccessary, and also talks about future plans for doing radio, which has now been done too. I also talk about how BBC doesn’t work on extenders, but of course now you can download the BBC programs you can watch them on extenders too. Also in there is my prediction that more TV companies will move to Flash, which was proved right on the 1st April when channel 4 moved over to Flash.

I’m really pleased with the progress over the past month that has been made that has added so many more features, but the interview is still a great picture of the software. Have a listen on the digital lifestyle ?site or subscribe to the podcast.