MediaElement/MediaPlayer/MediaUriElement hangs UI thread while loading a video

狂风中的少年 提交于 2020-06-26 13:28:18

问题


hey, i've got a wpf application that have a doubleanimation used for scrolling text and images (scrollbar) from the left side of the screen, to the right, and a movie playing, in the same window.

everytime a video ends, and a new video loads, the doubleanimation get stuck/hangs for a second, then it continues normally. i assume it's the control blocking the ui thread while loading the video. i've tried to create a seperate UI thread for the scrolling bar but i didn't solve the problem. i've tried using MediaElement, MediaPlayer and MediaUriElement control with no success.

any help would be appreciated.


回答1:


That's a known issue with MediaElement. You pretty much have to preload your videos...which means block the UI thread no, or later ;).

You can also try my MediaUriElement in my WPF MediaKit project. I did as much as possible off thread so this wouldn't happen.

http://wpfmediakit.codeplex.com



来源:https://stackoverflow.com/questions/3790944/mediaelement-mediaplayer-mediaurielement-hangs-ui-thread-while-loading-a-video

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