0

We have a radio application that streams MP3 over HTTP using an instance of the MediaPlayer class. In devices running new Android versions (i.e, Note 3 running Android 4.3), the music plays for about half a second, and then waits (buffers?) for up to 10 seconds, and plays again. I guess this unwanted behavior is due to the increased buffer size of the MediaPlayer in newer Android versions. Since there's no way to set the buffer size, there are few options left:

  • Stream Proxy
  • AudioTrack + MP3 Decoder
  • OpenSL

I have read many posts about those, and concluded that the best way would be using AudioTrack with an MP3 decoder like FFMPEG. However, I am open to suggestions and any guidances since I do not have any knowledge about Android NDK, JNI and FFMPEG...

burakk
  • 1,231
  • 2
  • 22
  • 45
  • 1
    Any reason why MediaCodec (http://developer.android.com/reference/android/media/MediaCodec.html) wouldn't work? If it did you wouldn't need to involve the NDK. – fadden Feb 16 '14 at 17:13
  • Increased buffer size should fix this problem, not make it worse. If you have ruled out all possible network troubles, this sounds like an issue with sample rate. If your Android device is stuck at 48kHz playing back 44.1kHz audio, it will have to stop and buffer again. Do rule out network issues, as that is almost always the problem. – Brad Feb 16 '14 at 22:08
  • @fadden, thanks for introducing me to the API, but I encountered the following problem. Maybe you could help me... http://stackoverflow.com/questions/21864255/android-mediacodec-api-music-plays-on-emulator-not-on-the-device – burakk Feb 18 '14 at 20:10

0 Answers0