简体   繁体   中英

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. 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. I am also using the MediaElement.Position property to seek.

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? 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. I have vague recollections of this helping with something similar once before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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