• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make audio streaming in android app?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 25
5
Android IntelliJ IDE Objective C
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jonathan Herrera
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks D. Smith your post was very helpful, from tomorrow I start to read the documentation

Thanks for your help
 
reply
    Bookmark Topic Watch Topic
  • New Topic