难道Android的所有版本支持的MediaPlayer流? [英] Do all versions of Android support the MediaPlayer streaming?

查看:233
本文介绍了难道Android的所有版本支持的MediaPlayer流?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我基本上想知道,如果在MediaPlayer流支持的作品为Android的所有版本。

As the title says, I'm basically wondering if the MediaPlayer streaming support works for all versions of Android.

下面是我目前使用的code,它在我的Andr​​oid 2.2手机正常工作:

Here is the code I'm currently using, which works fine on my Android 2.2 phone:

MediaPlayer mp = new MediaPlayer();
mp.setDataSource(SHOUTCAST_STREAM);
mp.prepare();
mp.start();

不过,将这项工作说的1.5或1.6?或者,我将不得不建立自己的缓冲管理体系,为流?

But will that work on say 1.5 or 1.6? Or would I have to build my own buffering management system for the stream?

*更新*

只是测试它的1.6模拟器,并得到以下错误。在2.2模拟器它工作正常。

Just tested it on the 1.6 emulator, and getting the following errors. On the 2.2 emulator it works fine.

23:15:50.074    31  ERROR   PlayerDriver    Command PLAYER_INIT completed with an error or info PVMFFailure
23:15:50.074    282 ERROR   MediaPlayer error (1, -1)
23:15:50.074    282 ERROR   MediaPlayer io error
23:15:50.074    282 ERROR   MediaPlayer java.io.IOException: Prepare failed.: status=0x1
23:15:50.074    282 ERROR   MediaPlayer     at android.media.MediaPlayer.prepare(Native Method)
23:15:50.074    282 ERROR   MediaPlayer     at org.me.bla.Bla.onCreate(Bla.java:38)
23:15:50.074    282 ERROR   MediaPlayer     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
23:15:50.074    282 ERROR   MediaPlayer     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
23:15:50.074    282 ERROR   MediaPlayer     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
23:15:50.074    282 ERROR   MediaPlayer     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3502)
23:15:50.074    282 ERROR   MediaPlayer     at android.app.ActivityThread.access$2200(ActivityThread.java:116)
23:15:50.074    282 ERROR   MediaPlayer     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1798)
23:15:50.074    282 ERROR   MediaPlayer     at android.os.Handler.dispatchMessage(Handler.java:99)
23:15:50.074    282 ERROR   MediaPlayer     at android.os.Looper.loop(Looper.java:123)
23:15:50.074    282 ERROR   MediaPlayer     at android.app.ActivityThread.main(ActivityThread.java:4203)
23:15:50.074    282 ERROR   MediaPlayer     at java.lang.reflect.Method.invokeNative(Native Method)
23:15:50.074    282 ERROR   MediaPlayer     at java.lang.reflect.Method.invoke(Method.java:521)
23:15:50.074    282 ERROR   MediaPlayer     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
23:15:50.074    282 ERROR   MediaPlayer     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
23:15:50.074    282 ERROR   MediaPlayer     at dalvik.system.NativeStart.main(Native Method)

那么,这是否意味着它只是简单地不上旧版本的操作系统的工作,或者是有任何变通?我想我可以只是做一个自定义的缓冲系统,但我要确保没有第一更简单的方法。

So does this mean it just simply doesn't work on on the older versions of the OS, or is there any work around? I guess I could just do a custom buffering system, but I want to make sure there isn't an easier way first.

推荐答案

根据 Android的参考在MediaPlayer类,因为API的级别已经可以:1并没有关于它是德precated什么。所以,我要说,你是安全的。

According to Android References the MediaPlayer class has been available since api level: 1 and there isn't anything about it being deprecated. So I would say you would be safe.

在您的1.6模拟器你开始浏览器并确保您可以访问互联网?

On your 1.6 emulator have you started the browser and made sure you can access the internet?

是,你必须创建前一段时间的1.6模拟器吗?我有问题与我有一段时间(的文件遭到损坏)之后创建的仿真器。如果是这样的话,你可以创建一个新的。

Was the 1.6 emulator one that you have create some time ago? I have had issues with emulators that I have created after a period of time (the files get corrupted). If that is the case you could create a new one.

我只是想到......另一件事是有一些认证失踪的地方?

Another thing I just thought of... Is there some authentication missing somewhere?

我发现这个<一个href=\"http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/\"相对=nofollow>可能会有所帮助,以及教程。他确实在他的例子创建一个缓存

I found this tutorial that might be helpful as well. He does create a buffer in his example.

这篇关于难道Android的所有版本支持的MediaPlayer流?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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