This is a migrated thread and some comments may be shown as answers.

How to clear/dispose of MediaPlayer when not needed?

1 Answer 346 Views
MediaPlayer
This is a migrated thread and some comments may be shown as answers.
TJ
Top achievements
Rank 1
TJ asked on 04 Nov 2011, 03:18 PM
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).

Thanks

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 09 Nov 2011, 04:15 PM
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,
Hristo
the Telerik team

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

Tags
MediaPlayer
Asked by
TJ
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or