MediaPlayer的扔在的是Android 5.0的错误(棒棒堂) [英] MediaPlayer throwing errors in Android 5.0 (Lollipop)

查看:2325
本文介绍了MediaPlayer的扔在的是Android 5.0的错误(棒棒堂)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个媒体应用程序,流使用HTTP连接的MP3。这已经在Android 2.x版本伟大的工作 - 4.x的,但现在在产生错误5.x中通过包含播放列表对象的MP3应用的周期,每一个都有自己独特的HTTP地址。第一个文件流的罚款,但下一个文件(无所谓的文件)会产生以下错误,当 prepareAsync()是名为:

I've written a media app that streams MP3s using an HTTP connection. This has been working great on Android versions 2.x - 4.x but is now generating errors in 5.x. The app cycles through a playlist object containing MP3s, each having its own unique HTTP address. The first file streams fine, but the next file (doesn't matter which file) produces the following errors when prepareAsync() is called:

07-04 18:57:19.785     65-10860/? E/NuCachedSource2﹕ source returned error -1, 10 retries left
07-04 18:57:22.874     65-10860/? E/NuCachedSource2﹕ source returned error -1, 9 retries left
07-04 18:57:25.907     65-10860/? E/NuCachedSource2﹕ source returned error -1, 8 retries left
07-04 18:57:28.929     65-10860/? E/NuCachedSource2﹕ source returned error -1, 7 retries left
07-04 18:57:31.972     65-10860/? E/NuCachedSource2﹕ source returned error -1, 6 retries left
07-04 18:57:35.024     65-10860/? E/NuCachedSource2﹕ source returned error -1, 5 retries left
07-04 18:57:38.062     65-10860/? E/NuCachedSource2﹕ source returned error -1, 4 retries left
07-04 18:57:41.085     65-10860/? E/NuCachedSource2﹕ source returned error -1, 3 retries left
07-04 18:57:44.110     65-10860/? E/NuCachedSource2﹕ source returned error -1, 2 retries left
07-04 18:57:47.262     65-10860/? E/NuCachedSource2﹕ source returned error -1, 1 retries left
07-04 18:57:50.294     65-10860/? E/NuCachedSource2﹕ source returned error -1, 0 retries left
07-04 18:57:50.419     65-10857/? E/GenericSource﹕ Failed to init from data source!
07-04 18:57:50.428    9592-9758/net.kicksass.shootingstarbbs.streamstar E/MediaPlayer﹕ error (1, -2147483648)
07-04 18:57:50.429    9592-9592/net.kicksass.shootingstarbbs.streamstar E/MediaPlayer﹕ Error (1,-2147483648)

在一般情况下,应用程序调用MediaPlayer的的setDataSource(URL)然后按 prepareAsync(),然后在preparedListener 等待火其中启动后()被称为流开始。当流完成后,它会调用复位()然后的setDataSource(URL),其中的过程又重新开始。

In general, the app calls MediaPlayer's setDataSource(url) followed by prepareAsync(), then waits for the onPreparedListener to fire after which start() is called to begin streaming. Upon streaming completion, it calls reset() and then setDataSource(url) where the process begins again.

为什么棒棒堂的MediaPlayer的抛出这个错误?

Why is Lollipop's MediaPlayer throwing this error?

推荐答案

它看起来像用于自动连接codeA传入的的setDataSource(字符串)方法URL与Android的previous版本,但不再V5.x中这些错误发生了,因为在Web服务器返回一个HTTP 404未找​​到。当我连接code将其传递给的setDataSource()它的工作原理之前的URL。

It looks like the setDataSource(string) method used to automatically encode a passed-in URL with previous versions of Android but no longer in v5.x. The errors were occurring because the web server was returning an HTTP 404 Not Found. When I encode the URL before passing it to setDataSource() it works.

要进一步迷惑的事情,我的应用程序被编码不一致的URL,所以有时它的工作和其他时候没有。

To further confuse things, my app was inconsistently encoding the URL, so sometimes it worked and other times it did not.

这篇关于MediaPlayer的扔在的是Android 5.0的错误(棒棒堂)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆