如何实现音频播放器使用的MediaPlayer和MediaController的Andr​​oid? [英] How to implement an audio player for Android using MediaPlayer And MediaController?

查看:322
本文介绍了如何实现音频播放器使用的MediaPlayer和MediaController的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个Android应用程序,它是一个网络电台的客户端。我希望它看起来本地到Android?但IM混淆与Android API逻辑和文档。我所得到的是,我需要的MediaPlayer和MediaController类。我是正确的,是有音频播放器为Android?

任何很好的例子

特别是,我很感兴趣如何使用的MediaPlayer 的MediaController 类在一起。

UPD:

最后,我已经得到了code,这不正是我想要的:

 意向书我=新的意图(Intent.ACTION_VIEW);
乌里U = Uri.parse(%file_uri%));
i.setData(U);
startActivity(ⅰ);
 

解决方案

你可以看看这些链接:

<一个href="http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/">http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/

<一个href="http://www.helloandroid.com/tutorials/musicdroid-audio-player-part-i">http://www.helloandroid.com/tutorials/musicdroid-audio-player-part-i

希望这将有助于。

您也纷纷在官方Android开发者网站上的一些例子:

<一个href="http://developer.android.com/guide/topics/media/index.html">http://developer.android.com/guide/topics/media/index.html

I want to create an Android application that is a client for an Internet radio station. And I want it look native to Android? But im confused with Android API logic and documentation. What i've got is that I need MediaPlayer and MediaController classes. Am I right, and is there any good example of AUDIO player for Android?

Especially, I'm very interested how to use MediaPlayer and MediaController classes together.

UPD:

Finally I've got the code, that does exactly what I want:

Intent i = new Intent(Intent.ACTION_VIEW);    
Uri u = Uri.parse(%file_uri%));    
i.setData(u);    
startActivity(i);

解决方案

you can look at those links :

http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/

http://www.helloandroid.com/tutorials/musicdroid-audio-player-part-i

Hope it will help.

[EDIT]

You have also some example on the official android developer website :

http://developer.android.com/guide/topics/media/index.html

这篇关于如何实现音频播放器使用的MediaPlayer和MediaController的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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