简体   繁体   English

Windows Phone 7:在MediaElement中寻求

[英]Windows Phone 7: Seeking in MediaElement

I'm working with a MediaElement for Windows Phone 7, and I want to make a simple slider that will allow a user to seek within an mp3 file. 我正在使用Windows Phone 7的MediaElement ,我想制作一个简单的滑块,使用户可以在mp3文件中进行搜索。 I can't quite get the behavior I want though. 我不能完全得到我想要的行为。 When I seek a short distance forward, it will work fine. 当我向前寻找一小段距离时,它将正常工作。 But if I try to seek to the far end of the media, it will no longer play and go silent. 但是,如果我尝试寻找媒体的另一端,它将不再发挥作用并保持沉默。 Is there some sort of buffering that is occuring under the hood that is preventing seeking long distances? 引擎盖下是否存在某种缓冲,导致无法寻求长距离行驶? Has anyone overcome this issue or found a solution? 有谁克服了这个问题或找到了解决方案?

I've been referencing this post on msdn for info, but my URI is coming straight from media included in the xap file, not being transferred over a network protocol. 我一直在msdn上引用帖子以获取信息,但是我的URI直接来自xap文件中包含的媒体,而不是通过网络协议传输的。 I am also using the MediaElement.Position property to seek. 我也在使用MediaElement.Position属性来查找。

Have you tested that the media will play to those "far points" if you just let it play normally and don't try and skip ahead to them? 您是否已经测试过,如果您让媒体正常播放并且不尝试跳过这些媒体,它们将发挥这些“远点”作用? If this fails too it could indicate a corrupt file. 如果仍然失败,则可能表明文件已损坏。

How are you requesting the change relative to multiple changes to the slider? 相对于滑块的多次更改,您如何请求更改? If you're making lots of changes to the position in quick succession this may be the problem. 如果您要快速连续更改职位,则可能是问题所在。 Are you checking CanSeek each time before you change the position? 您是否在更改职位之前每次都检查CanSeek Does your slider allow for a single event to trigger a big "jump" or does it try and do lots of little ones? 您的滑条是否允许单个事件触发一个大的“跳跃”,或者它会尝试做很多小的活动?

It may also be worth copying the file to IsolatedStorage and trying to play it from there. 将文件复制到IsolatedStorage并尝试从那里播放也是值得的。 I have vague recollections of this helping with something similar once before. 我以前曾经有过类似的回忆,对此记忆犹豫。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM