MediaElement/MediaPlayer/MediaUriElement 在加载视频时挂起 UI 线程
嘿, 我有一个 wpf 应用程序,它有一个双重动画,用于从屏幕左侧滚动到右侧文本和图像(滚动条),并在同一窗口中播放电影。
每次视频结束并加载新视频时,双动画都会卡住/挂起一秒钟,然后正常继续。我认为这是加载视频时控件阻塞 ui 线程的原因。我尝试为滚动条创建一个单独的 UI 线程,但没有解决问题。我尝试使用 MediaElement、MediaPlayer 和 MediaUriElement 控件,但没有成功。
任何帮助将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 MediaElement 的一个已知问题。你几乎必须预加载你的视频...这意味着阻止 UI 线程,或者稍后;)。
您还可以在我的 WPF MediaKit 项目中尝试我的 MediaUriElement。我尽可能地脱离线程,这样就不会发生这种情况。
http://wpfmediakit.codeplex.com
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