May 12, 2010
Im experiencing an intermittent and very frustrating issue with MediaPlayer on Android when streaming MP3 over HTTP. Ive done as much research and debugging as I possibly can to try and find a solution, but am coming up short. I cant find reference to this issue anywhere, including b.android.com. Essentially, whats happening is MediaPlayer will not come out of the preparing state. The device is receiving audio data during this time, as indicated by network sniffs and the MediaPlayer buffering callback being invoked repeatedly with increasing percentage values, but eventually the buffer appears to become full and stops receiving. Because prepare() never returns, or more accurately when prepareAsync() is used and the onPrepared callback is never invoked, and neither the onError() nor onInfo() callbacks are invoked, the application can neither call MediaPlayer.start() nor make any sort of recovery. Other notable observations: The problem is intermittent, meaning that subsequent attempts to play the exact same MP3 stream from the exact same server may exhibit this behavior or not - The problem seems to be exasperated when the device is connected via 3G versus wifi - The problem occurs on different MP3s encoded by different software - The problem occurs when streaming from different HTTP servers - The problem cannot be reproduced on any of the Android SDK emulators - The problem can be reproduced on the HTC Incredible, Verizon Motorola DROID, and HTC Touch - When MediaPlayer successfully returns from the preparing state, there is an info message (what=1, extra=44) received. This info message is not received during the problematic case. Anyone ever experienced this, or even find a solution?
View 10 Replies