如何在Android背景播放串流音频?

前端之家收集整理的这篇文章主要介绍了如何在Android背景播放串流音频?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个 Android应用程序,使用MediaPlayer类从互联网播放流音频.

How do I let it continue to play the audio on the background when the
user hits the home button to run other applications?

@H_403_6@

在运行其他应用程序时,我希望继续播放音频.

解决方法

你必须使用一些名为Android Services的东西.

从文档:

“服务是应用程序组件,代表应用程序希望在不与用户交互的情况下执行更长时间运行的操作,或者为其他应用程序提供功能.

以下是使用服务让您开始的最佳官方指南:
http://developer.android.com/guide/components/services.html

这是一个关于构建音频播放器的好教程:
http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/

这是一个构建流式音乐播放器的视频教程:
http://www.youtube.com/watch?v=LKL-efbiIAM

原文链接:https://www.f2er.com/android/310725.html

猜你在找的Android相关文章