The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

MediaTransport - unable to get current object

Last post 08-15-2008, 11:36 AM by Cheetah. 9 replies.
Sort Posts: Previous Next
  •  08-13-2008, 8:40 AM 8072

    MediaTransport - unable to get current object

    Hi there,

    I have a background application with the following code:


            private MediaTransport CurrentMediaTransport
            {
                get
                {
                    MediaCenterEnvironment env = host.MediaCenterEnvironment;
                    if (env != null)
                    {
                        MediaExperience exp = env.MediaExperience;
                        if (exp != null) return exp.Transport;
                    }
                    return null;
                }
            }


            public void Start()
            {

                bool check = true;

                while (check)
                {
                    MediaTransport mt = CurrentMediaTransport;

                    if (mt != null)
                    {
                        DialogTest("Not null");
                        mt.PropertyChanged += new PropertyChangedEventHandler(mt_PropertyChanged);
                        check = false;

                    }
                    else
                    {
                        DialogTest("null");
                    }


                    Thread.Sleep(10000);
                }

            }

            void mt_PropertyChanged(IPropertyObject sender, string property)
            {
                //throw new NotImplementedException();
                DialogTest(property);
            }


    Basically, I am trying to get the current MediaTransport object, but it always returns null for me?

    Why is this? I've done a bit of searching, but couldn't find anything that would answer my question.

    I did however find out that the MediaTransport expires if left alone for a period of time, is this still the case? (I ask as I will need to do something with this information in future).

    I'm not the most experienced programmer so try not to go into too much technical speak :p

    Thanks.
  •  08-13-2008, 1:00 PM 8075 in reply to 8072

    Re: MediaTransport - unable to get current object

    The MediaTransport only exists when something is playing, so check you've started something playing first :)

    The expiry still stands - you need to keep polling a property at least every five minutes on the transport to keep it alive.

    Cheers,
    Andrew

  •  08-13-2008, 1:48 PM 8078 in reply to 8075

    Re: MediaTransport - unable to get current object

    That was my first inclination....that's why I put the while statement in to keep checking for it.

    When I play either music or a video, it still returns null.

    Any ideas?
  •  08-13-2008, 10:52 PM 8082 in reply to 8078

    Re: MediaTransport - unable to get current object

    What version of Media Center are you using? RTM or something else?

    Cheers,
    Andrew

  •  08-14-2008, 12:54 AM 8084 in reply to 8082

    Re: MediaTransport - unable to get current object

    I think (and I could be completely wrong) that this was broken in KB950126 (one of the June windows updates) and/or the Fiji build from around the same time.

    I had similar code (well, not really - but I was polling the transport) which was somewhat working earlier in the year but after this update (towards me putting it into production) I've found it dies/disappears on me under certain circumstances. Basically it will be there for the first file played and stay available (as well as update itself to reflect a new file) for as long as you want if there are no "long" gaps of nothing being played back.

    The same update has been attributed to randomly start a file from the beginning and/or restarting itself after being put on pause, not displaying the "Finished" dialog consitently etc (none of which I had trouble with before said hotfix).

  •  08-14-2008, 10:16 AM 8087 in reply to 8084

    Re: MediaTransport - unable to get current object

    It's definitely possible - a lot of things appear to be broken by 950126.  I have removed this update on my systems and supressed it from being re-installed.  

    Cheetah - you could try uninstalling the update and see if your app works how you'd expect it to.  Switch off Windows Update before you uninstall it otherwise it will get installed again.   If it doesn't resolve your problem, switch WU back on and the update will be reapplied.

    Cheers,
    Andrew

  •  08-15-2008, 7:11 AM 8097 in reply to 8082

    Re: MediaTransport - unable to get current object

    AndyC:

    What version of Media Center are you using? RTM or something else?

    Cheers,
    Andrew



    Windows Vista Home Premium 64-bit (Fully updated according to Windows Update).

    Windows Media Center Version: 6.1.1000.18273. (TV Pack 2008 is installed).
  •  08-15-2008, 7:20 AM 8098 in reply to 8087

    Re: MediaTransport - unable to get current object

    AndyC:

    It's definitely possible - a lot of things appear to be broken by 950126.  I have removed this update on my systems and supressed it from being re-installed.  

    Cheetah - you could try uninstalling the update and see if your app works how you'd expect it to.  Switch off Windows Update before you uninstall it otherwise it will get installed again.   If it doesn't resolve your problem, switch WU back on and the update will be reapplied.

    Cheers,
    Andrew



    I did as you suggested, but it still gives me null, and I am pretty sure nothing is wrong with the code i provided.
  •  08-15-2008, 7:55 AM 8099 in reply to 8098

    Re: MediaTransport - unable to get current object

    Cheetah,

    Can you email me at andrew at digitallivingsolutions.co.uk

    Cheers,
    Andrew

  •  08-15-2008, 11:36 AM 8102 in reply to 8099

    Re: MediaTransport - unable to get current object

    Emailed you Andrew.
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems