I m using MediaElement to play a web video. When I left the page I noticed in the Task Manager that my app was still using 10% of network and didn't drop till it finished downloading video.
I tried doing the following but no luck.
//open link;
mediaElement.Source = welcomeVideoURL;
//when I leave the page OnNavigatedFrom()
mediaElement.Stop();
mediaElement.ClearValue(MediaElement.SourceProperty);
mediaElement.Source = null;
Also tried to set the source to a dummy link but still no luck.
I thought that opening the Link as a Stream and use mediaElement.SetSource()
could work but I haven't found anything on that...maybe I m not searching correct.
Thank you.
Found this MediaElementWithHttpClient in some other question in a comment made by @kiewic. I can manage the stream and download process and easily dispose it.
HttpRandomAccessStream videoStream = await HttpRandomAccessStream.CreateAsync(new Windows.Web.Http.HttpClient(), videoUrl);
mediaElement.SetSource(videoStream, videoStream.ContentType);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With