WP7 MediaElement 下载问题
我在 WP7 上遇到问题,MediaElement 从 Web 服务为我正在开发的音乐播放器应用程序下载 128kbps mp3 流。当 wp7 连接到 wifi 时,文件下载正确,但在断开 wifi 时,下载有时会停止。问题是,当下载失败并且 MediaElement 状态为“正在播放”时,我没有收到任何错误或异常。 MediaElement 正好经过流的下载部分并运行,就像正在播放一样,但由于下载停止,没有任何内容可播放。我可以根据我的位置并使用 3g 而不是 wifi 来重现这个问题,所以我相信这是由于连接速度较低造成的。我不认为在这种情况下需要显示任何代码,但我尝试发布一些内容。我想知道我是否可以控制这个?我可以使用任何其他事件来检测下载失败的情况吗?有没有其他方法可以下载更可靠的 mp3 流并播放?我应该尝试其他播放器/组件吗?
提前致谢
I'm running into problems on the WP7 with MediaElement downloading a 128kbps mp3 stream from a web service for a music player app that i'm working on. The file downloads correctly when the wp7 is on a wifi connection, but downloading sometimes stops when off of wifi. The problem is that i'm not getting any errors or exceptions when the downloading fails and the MediaElement state is "playing". MediaElement runs right past the downloaded portion of the stream and acts like it is playing, but there is nothing to play since the download stopped. I can somewhat replicate this issue based upon my location and using the 3g instead of wifi, so i believe it is due to a low connection. I don't believe any code needs to be shown in this instance, but i try to post something. I want to know if I have any control over this? Are there any other events I could use to detect when the download has failed? Is there another way I could download a mp3 stream that is more reliable and play it? Is there another player/component I should try?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在某种程度上,您始终可以使用 MediaStreamSource 来尝试处理下载并实现流式传输。这是一种更“痛苦”的方法,因为您必须使用额外的媒体层,但它通过提高播放稳定性而得到回报。
这是一个入门Tim Heuer 的示例。具体看一下他如何利用
MediaStreamSource
的自定义实现。 此处是一个更复杂的示例。如果不需要流式传输,您可以下载文件(并将其存储在独立存储中),然后从那里播放。
You could always use
MediaStreamSource
to try to handle the download and implement streaming, to some extent. It is a more "painful" way of doing this since you will have to work with an extra media layer, but it pays off by improving playback stability.Here is a starter example by Tim Heuer. Take a look specifically at how he takes advantage of a custom implementation of
MediaStreamSource
. Here is a more complex sample.If streaming is not a requirement, you could download the file (and store it in the Isolated Storage) and then play from there.