MediaElement web Video doesn't stop buffering

☆樱花仙子☆ 提交于 2019-12-08 15:02:37

问题


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.


回答1:


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);


来源:https://stackoverflow.com/questions/35275946/mediaelement-web-video-doesnt-stop-buffering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!