问题
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