MediaElements continue to play after Navigation page is changed RRS feed

  • Question

  • Hello everyone

    I have a navigation page that has a couple of MediaElements on it.  When the page is changed due to a user action the elements continue playing on in the background even though the page has changed and you can't see them, although they are still using CPU! 

    There doesn't appear to be any OnPageClose type override or way to actually force the page to die.  Does anyone know how you can force the page to close and cleanup when it changes?

    Many thanks

    Monday, June 30, 2008 11:15 PM


  • I think you could hook up to Page.Unloaded event, and inside the Unloaded event handler, you could stop the MediaElement by calling MediaElement.Stop(), and nullify it.

    Hope this works for you.

    • Marked as answer by Marco Zhou Monday, July 7, 2008 10:32 AM
    Thursday, July 3, 2008 8:27 AM