ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

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

Open nightwolf738 opened this issue 10 years ago • 5 comments

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?

nightwolf738 avatar Jun 15 '16 18:06 nightwolf738

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.

cyberjaime45 avatar Jun 21 '16 01:06 cyberjaime45

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.

Ood-Tsen avatar Jun 21 '16 03:06 Ood-Tsen

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 ;)...

ojw28 avatar Jun 21 '16 14:06 ojw28

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.

nightwolf738 avatar Jun 24 '16 18:06 nightwolf738

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.

ojw28 avatar Jul 07 '16 11:07 ojw28