显示元数据从冰播服务器在Android应用程序



我想从iccast流服务器之一获得元数据信息,并在我的Android应用程序中显示这些数据。任何建议吗?

使用下面的代码,我无法获得完整的元数据(艺术家和标题....)

代码
String  stringUrl="http://dev.kigen.co:8000/xrm-ele.opus";
URL url = null;
try {
    url = new URL(stringUrl);
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
URLConnection cn = null;
try {
    cn = url.openConnection();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}   
try {
    cn.connect();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}   
int pos=1;
String x;
String y;
while (cn.getHeaderField(pos) != null) { 
    x=cn.getHeaderFieldKey(pos); 
    y = cn.getHeaderField(x); 
    System.out.println(":::::"+""+x+" : "+y); 
    pos++; 
}

}

生成输出

:::::Server : Steamcast Distributed Network Media Server/1.0.0 decennium (Windows 64-bit)
:::::Date : Sat, 24 Oct 2015 16:52:16 GMT
:::::Connection : Keep-Alive
:::::Content-Type : application/ogg
:::::Cache-Control : max-age=0, no-cache, no-store
:::::Expires : Mon, 25 Jan 2002 10:11:57 GMT
:::::Pragma : no-cache
:::::ice-name : [XRM] - Electronic
:::::ice-genre : Electronic, Dance, Trance
:::::ice-url : http://www.xrm.fm/
:::::ice-public : 1
:::::ice-bitrate : 64
:::::ice-description : XRM Electronic in OGG Opus
:::::ice-audio-info : 
:::::Transfer-Encoding : chunked
:::::Set-Cookie : __steam_sess=8134e975470ac65a-5edd5a42-4a1b-6f58-87d4e64dc919bc08fb1821b0; path=/

我看到你使用我的Steamcast服务器。这不是Icecast,因此有点不同。然而,最大的问题是您正在使用Opus流。这些是OGG封装的流。您可以尝试使用android.media. mediametadataretriiever来检索元数据。不同版本的Android有不同的功能。因此,它可能无法在所有版本上正确工作。

相关内容

最新更新