Reputation: 51
I am making a Radio like app in Android that uses streaming, here I need to stream the audio from a link
http://sc-ccountry.1.fm:7806/listen.pls
in background. This link I got from JSON response. I am able to play MP3 type of audio in MediaPlayer but ".pls" can not be played.
What is the issue with that? How do I overcome that?
Upvotes: 2
Views: 635
Reputation: 7827
A .pls file is a file format used by SHOUTcast and Icecast, for stream media, according to Wikipedia. It's definitely not supported by Android media players natively. But it looks awfully easy to parse yourself. The file format is a basic .ini file, which is trivial to write a parser for. You'll have to figure out yourself what the various tags are.
You should probably request the HTTP headers of any file you're going to pass off to a media player, before you do so, just to make sure that the content type of the stream is reasonable. If you're scraping content from web radio stations, you'll see a lot of content wrapper formats in addition to .pls files (e.g. M3U files are pretty common too).
You can use the HTTP HEADER verb instead of the GET verb to see what the headers are without also getting the content. Or maybe they're kind enough to give you the MIME type in the JSON.
Upvotes: 1