0

I have been trying to play an audio stream (a shout cast stream) on my android application using AMBIENCE (a sound library with services written to play a url). Ambience uses native android player for playback yet it provides a wrapper for playback related functions. The issue is I have been facing delays in streaming i.e the stream plays but after an interval of 2 to 3 minutes. The library works fine on mp3 files but delays loading in shoutcast stream.

I need help if any one can advice a solution which can load streams more quickly than this.

Noor Ahmed
  • 1,357
  • 7
  • 14
  • I have tried getting help from internet but no one addresses this issue – Noor Ahmed Sep 28 '15 at 17:06
  • Does this MP3 stream play without delay? http://currentstream1.publicradio.org:80/ – Matt Harrington Sep 29 '15 at 18:05
  • Hello @MattHarrington, first of all thanks for responding. Yes your stream played without delay on emulator (genymotion) but same problem on a real device (samsung s4). – Noor Ahmed Oct 01 '15 at 19:01
  • Take a look at how I solved a similar problem, but with Icecast: http://stackoverflow.com/questions/6582908/why-does-it-take-so-long-for-androids-mediaplayer-to-prepare-some-live-streams/32874710#32874710 – Matt Harrington Oct 02 '15 at 19:47
  • Consider switching to ExoPlayer. It fixed a similar problem I was having, and I didn't have to adjust Icecast's burst-size setting. – Matt Harrington Oct 27 '15 at 19:54

1 Answers1

1

To clarify, the symptom of the problem is that you start the stream but don't hear anything for 2-3 minutes due to buffering, and then you hear the stream, correct?

If it takes that long then you have an issue of connectivity somewhere. I've seen up to 30 seconds or so of buffer time on some Android devices, but not anywhere near 2-3 minutes. I've also seen plenty of cases where the emulator works fine but the device doesn't. (It's my guess that most Android devices are handing off the stream to a hardware codec, creating the difference, but I don't know that for sure.)

Use a packet sniffer like Wireshark to verify what's happening over the wire. Make sure that the data is actually getting to the device. There might also be an issue on the encoder end in front of the SHOUTcast server, preventing the data from getting to it in a timely manner. But, this is unlikely since you had a problem with another stream that works fine.

Brad
  • 146,404
  • 44
  • 300
  • 476