iOS online radio streaming questions

北慕城南 提交于 2019-11-30 02:16:15

Icecast and Shoutcast are compatible with each other. The difference lies in the way they respond to a HTTP GET request. When you send a HTTP GET request to an Icecast server it will reply with a HTTP 200 OK response. The response headers will contain values for the icy-br, icy-metaint, icy-name, icy-genre and icy-url keys.

When you send a HTTP GET request to a Shoutcast server it will respond with a ICY 200 OK response. In this case you'll have to parse the response data because the metadata will not be available in the response headers.

The most important metadata key is the icy-metaint key. This value will tell you how often the metadata is sent in the stream. For more information about parsing this metadata have a look at this website: Shoutcast Metadata Protocol

To play ogg streams you'll need to use the open source FFmpeg library. This library can be compiled for the iOS platform and used to connect and decode ogg streams.

To play an ogg formatted audio stream, you would need to supply a codec. iOS does not have native support for the ogg format

I think the first thing to do is to "order" the meta data by setting the request header:

CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Icy-MetaData"), CFSTR("1"));

In my case I added this line to Matt Galaghers's Audio Streamer. The result was that I could actually hear the metadata when the stream was playing because it was contained in the stream data. The next step was to filter the meta data out and interpret it. To achieve this all the necessary information are already mentioned here.

Good luck!

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