Exoplayer: Shoutcast streaming error on Android 4.3 (Works fine on 5.0+)

Created on 15 Jun 2016  路  5Comments  路  Source: google/ExoPlayer

In ExoPlayer demo app, I want to stream a Shoutcast which its URL is http://31.210.157.103/

I set the type as TYPE_OTHER. It works fine on my 5.1.1 and 6.0 devices but fails on 4.3 device giving the following exception:

E/ExoPlayerImplInternal: Internal track renderer error.
                                                                                          com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.upstream.HttpDataSource$InvalidResponseCodeException: Response code: -1
                                                                                              at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:263)
                                                                                              at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:149)
                                                                                              at com.google.android.exoplayer.ExoPlayerImplInternal.incrementalPrepareInternal(ExoPlayerImplInternal.java:283)
                                                                                              at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:205)
                                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                              at android.os.Looper.loop(Looper.java:176)
                                                                                              at android.os.HandlerThread.run(HandlerThread.java:61)
                                                                                              at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
                                                                                           Caused by: com.google.android.exoplayer.upstream.HttpDataSource$InvalidResponseCodeException: Response code: -1
                                                                                              at com.google.android.exoplayer.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:210)
                                                                                              at com.google.android.exoplayer.upstream.DefaultUriDataSource.open(DefaultUriDataSource.java:135)
                                                                                              at com.google.android.exoplayer.extractor.ExtractorSampleSource$ExtractingLoadable.load(ExtractorSampleSource.java:720)
                                                                                              at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:209)
                                                                                              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
                                                                                              at java.util.concurrent.FutureTask.run(FutureTask.java:234)
                                                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
                                                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
                                                                                              at java.lang.Thread.run(Thread.java:841)

How can I overcome with this issue? I looked some similar issues in this project like icy implementation, but their code was not enough to build properly.

Any ideas?

All 5 comments

Hey, I had the same problem. The issue here I believe is the response being -1. Somehow Android >=5 is able to handle this. However android 4+ fails due to a non- ok response.

In order to avoid go around I modified the validation response to: (responseCode >= 1 && responseCode < 200 || responseCode > 299)

This is not best way, but it works just fine.

This seems HttpUrlConnection problem. It should be fixed on Android 4.4.
Android as of Android 4.4 is using OkHttp for its internal HttpUrlConnection implementation.

Isn't the problem more that the server is using ICY, which isn't _real_ http? I wouldn't say it's a problem that an http stack can't handle a non-http protocol. It's more an added bonus if it does ;)...

Same URL perfectly works on RadioPlayerService
It also works on FFmpegMediaPlayer

Removing ExoPlayer from my project.

You can close this issue if you feel good.

Closing since we do not officially support ICY. As per @cyberjaime45 above, there exist pretty trivial solutions to make it work if you wish to do so.

Was this page helpful?
0 / 5 - 0 ratings