permaculture playing cards*
The moose likes Android and the fly likes How to make audio streaming in android app? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to make audio streaming in android app?" Watch "How to make audio streaming in android app?" New topic
Author

How to make audio streaming in android app?

Jonathan Herrera
Greenhorn

Joined: Oct 09, 2008
Posts: 2
Hi to everyone, I need some documentation or API to audio streaming, I want to develop an android app that stream MP3, AAC+ and can be possible have ore of radio stations in the same app.

thanks for your help

ciao
D. Smith
Author
Greenhorn

Joined: Jan 11, 2013
Posts: 25
    
    5

Hi Jonathan -

The simples option for media playback in the Android framework is MediaPlayer, which can take either a local media file or a URL to a remote media source and play it back on the device. This is the easiest solution because it allows you to pass any encoded media that Android supports and it will do the rest. If you are able to decode the audio data yourself ahead of time, you could also look at AudioTrack as another way of streaming the audio content, but you will need to do more of the back-end decoding work yourself.

From an architecture perspective, you are going to want to put the MediaPlayer inside of a Service component inside of your application, which will allow the playback to continue uninterrupted even if the user leaves the application to go do something else. Your user interface inside of an Activity can communicate with this Service to start/stop playback and change the audio data source, but you shouldn't house any of the playback code there. Activity elements are meant only to interact with the user and not handle any long-running operations beyond when the user interaction ends.

Some documentation links:
https://developer.android.com/reference/android/media/MediaPlayer.html
https://developer.android.com/guide/components/services.html


Android Recipes: A Problem Solution Approach: http://www.apress.com/9781430246145
Jonathan Herrera
Greenhorn

Joined: Oct 09, 2008
Posts: 2
Thanks D. Smith your post was very helpful, from tomorrow I start to read the documentation

Thanks for your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make audio streaming in android app?
 
Similar Threads
Java Newbie Problem - streaming
How to view online cemra via url ?
Streaming Video Servlet
JAVA Sound:How to implement seek functionality
How to play audio in the background