Android Question [Solved] Read online radio stream icy-metaint

musaso

Active Member
Licensed User
Longtime User
Is it possible to read the data from a radio stream contained in icy-metaint?
I have implemented this class in java and it works fine, but wanted to know if it can be done with OkHttpClient.


Mi code:
    hc.Initialize("hc")' OkHttpClient
    Dim req As OkHttpRequest
    req.InitializeGet("http://185.23.192.118:8008/;")
    req.SetHeader("Icy-MetaData", "1")
    req.SetHeader("Connection", "close")
    req.SetHeader("Accept", Null)
    hc.Execute(req,0)
   
    Private Sub hc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
        Log(Response.ContentType)'<---- return audio/mpeg
        Log(Response.GetHeaders)'<---- return map headers
    End If

(MyMap) {accept-ranges=[none], access-control-allow-origin=[*], cache-control=[no-cache,no-store,must-revalidate,max-age=0], connection=[close], content-type=[audio/mpeg], icy-br=[128], icy-genre=[folk latina latin], icy-metaint=[32768], icy-name=[RADIO CHANQUETE MALAGA (www.chanquetefm.com) ANDALUCIA ESPANA SPAIN ESPANOL], icy-notice1=[<BR>This stream requires <a href="http://www.winamp.com">Winamp</a><BR>], icy-notice2=[SHOUTcast DNAS/posix(linux x86) v2.5.5.733<BR>], icy-pub=[1], icy-sr=[44100], icy-url=[http://www.chanquetefm.com], x-clacks-overhead=[GNU Terry Pratchett]}


Java class code :

URLConnection con = streamUrl.openConnection();
con.setRequestProperty("Icy-MetaData", "1");
con.setRequestProperty("Connection", "close");
con.setRequestProperty("Accept", null);
con.connect();
int metaDataOffset = 0;
Map<String, List<String>> headers = con.getHeaderFields();
InputStream stream = con.getInputStream(); <----- ???
 
Last edited:

kisoft

Well-Known Member
Licensed User
Longtime User
Hi, you can show the full code. Take a look at this thread:
 
Upvote 0
Top