Reputation: 1379
I have created a Popup of media player in which i am playing a MediaElement (i.e. Video). I have a close button as well on this Popup, which will close the media popup but problem is if i will click the Close button it will stop the MediaElement byt MediaElement.Stop(); and will hide the Popup as well. But continue to MediaElement Process in background As MediaElement.Stop() will just pause the Media and reset its point to 0.0
Can someone please help how i can remove this MediaElement from background, which is actually affecting my App Performance.
Upvotes: 0
Views: 285
Reputation: 618
Try in following sequence:
Upvotes: 1
Reputation: 4899
the Best way you can work this out is by using a stream. open the audio using System.IO.Stream
and when your popup closes then do (new System.IO.Stream()).Dispose();
Although using using
keyword will automatically help you to dispose the stream but untill and unless a source is specified to the mediaelement then it will affect its performance . Try setting the source using setSource()
method to null or the uri source to null. and then do a
(new System.IO.Stream()).Dispose();
Let me know if this works.
Upvotes: 0