How to clear/dispose of MediaPlayer when not needed?

2 posts, 0 answers
  1. TJ
    TJ avatar
    1 posts
    Member since:
    May 2011

    Posted 04 Nov 2011 Link to this post

    Our product uses the RadMediaPlayer control in one area. I'm having a problem with CPU usage. Our CPU usage is pretty low until the MediaPlayer begins playing a video, which is expected. However, when the video finishes playing or the user cancels out, CPU usage stays high until the user reloads the website.

    Is there a preferred way to clear or dispose of the MediaPlayer programmatically when it's not needed anymore? I've tried stopping it (Stop method), setting the Source of its RadMediaItems to null, clearing its Items collection, setting its DataContext to null, and even removing it from the visual tree. Regardless, CPU usage remains very high (30 - 50% on a quad-core system) after the MediaPlayer is used.

    Our application uses some effects (specifically the stock Silverlight DropShadowEffect) which does make rendering more CPU intensive than normal. We are aware of this and it we don't consider it a problem unless the CPU usage doesn't return to normal idle levels when the user quits interacting with the application. It does make it easier to tell when something is triggering rendering updates when we think it shouldn't be.

    We're developing using Silverlight 4.0.60831.0 and C#. The issue occurs on all systems we've tested (Windows XP and 7, Firefox, Internet Explorer, Chrome).

  2. Hristo
    Hristo avatar
    352 posts

    Posted 09 Nov 2011 Link to this post

    Hi Tj,

    We are not aware of such an issue. Could you try to set the RadMediaPlayer.MediaElement.Source property to null?
    If this doesn't help, you could try to replace the media player with MediaElement and check if the issue persists. RadMediaPlayer is using MediaElement internally which means the overhead can be caused by the MediaElement.
    If suggested scenarios don't help, could you send us a sample repro project in order to investigate the root cause?

    Best wishes,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top