Unexpected status line: ICY 200 OK for URL openStream() method?

核能气质少年 提交于 2019-12-04 06:35:44

Various changes were made for Android 4.4, and it seems that the non-standard ShoutCast ICY header is not supported by Android.

It seems though that the good people of OkHttp fixed the issue (issue 1 and issue 2) already a few days ago.
What you can do, is simply use OkHttp lib directly in your application and by that you'll use the newer OkHttp version (the one with the fix) and not the one shipped with Android (where you'll have to wait for an OS update).
This will also fix it for your application running on other devices that might suffer from that issue.

The answer of Assaf Gamliel worked for me. For those not familiar with this, you have to download the last .jar from okHttp and the .jar from the dependency okio . Add them to your libs directory and connect like this :

OkHttpClient client = new OkHttpClient();
 Request request = new Request.Builder()
 .url(mediaUrl)
 .build();

 Response response = client.newCall(request).execute();
 InputStream stream = response.body().byteStream();

The easiest fix ever. which is 100% working for me, for shoutcast , change your URL ex. "http://192.168.1.1:9292" to "icy://192.168.1.1:9292" and you'll be fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!