Silverlight MediaElement 在播放前读取内容到末尾
我正在开发一个 silverlight 4 项目,其目标是播放本地 PC 上文件的视频(首先下载这些文件,然后播放)。
我遇到的问题是,对于相对较大的视频文件(即 350 MB 以上),一旦设置了源,媒体元素就会“挂起”大约 8-10 秒。据我所知,MediaElement 在加载之前正在将内容读取到文件末尾。当 mediaElement 处于“正在打开”状态时,似乎没有事件 - 只有“已打开”。延迟似乎是在设置媒体元素的源和媒体元素达到“打开”状态之间。
有什么办法可以解决这个问题吗?至少有一种方法可以防止媒体元素在加载时挂起应用程序吗?
I am working on a silverlight 4 project, where the goal is to play back video from files on the local PC (these files are downloaded first, and then played).
The problem I am having is that for relatively large video files (i.e. 350 MB+), the media element 'hangs' for about 8-10 seconds once the source has been set. From what I have read, the MediaElement is reading the content to the end of the file before it is loaded. There seems to be no event for when the mediaElement is in the "Opening" state - only "Opened". The delay seems to be between setting the source of the media element and the media element hitting the "Opened" state.
Is there a way I can work around this? At the very least is there a way that I can prevent the mediaelement from hanging the application while it loads?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将 SetSource 放入后台工作程序中,然后在 UI 调度程序上调用 BeginInvoke,它似乎已经完成了任务。调用了错误的 Invoke 方法。
I put the SetSource into a background worker and then called BeginInvoke on the UI dispatcher and it seems to have done the trick. Was calling the wrong Invoke method.