Kodi Community Forum

Full Version: Detect live internet stream
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi folks,

Is there a reliable way to detect a continuous live internet radio stream? The reason for this question is that I've modified my favourite skin to look better with live radio streams. Now I use kind of a workaround to solve the problem, but it should be done in a more reliable way.

I thought Player.HasDuration was the solution, but it returns True even if the stream doesn't have a real duration. At least with the streams I listen to.

Listen to http://sverigesradio.se/topsy/direkt/1603-hi.aac (fullscreen) and you will understand what I'm after. Both Time and Duration changes and the progressbar jumps back and forth.

- Janne
Internet radio streams are usually shoutcasts (an mp3 stream with it's own metadata format),  that may offer a way for the skin to know. The player certainly knows what it is playing, but I don't know how much stream info is available to the skin.

But perhaps you are approaching this the wrong way? Have a look at what the various radio addons do e.g. Radio, and Soundclound addons, that may give clues.
I use the Sveriges Radio Addon. With recorded streams it works OK. It just the continuous streams the has a kind of duration wich I suspect is related to the buffering.

But as I said, I'm using a workaround that works for now. The live streams I listen to has no MusicPlayer.Album :-)
@DaveBlake I am with @JanneT on this.  I too have come up against this issue, unfortunately while one thing might work for one addon it does not necessarily mean that it will work for another.  There is a system boolean called
Code:
Player.IsInternetStream
, but I suspect it is only of use if the addon writer has set this boolean to true and it also is of no use if the addon allows the playing of a locally saved stream as I would guess strictly speaking it is not a internet stream in that case. If Kodi set a boolean if the file being played was of a recognised stream file type this would mean we would not have to rely on the addon writer to provide a useful indicator of a stream playing.

Wyrm (AppTV)
All I was saying is that the player detects if it is playing a continuous live internet radio stream, it does not rely on addons to tell it. But the player does not decode the Shoutcast metadata, so if you want station or song title then you need an addon to do that part.

What I don't know is if the player passes that info to the skin. The system boolean  Player.IsInternetStream  is very likely only set by the player but I don't know as this is not my area of knowledge. However that alone does not mean it is a Shoutcast. But at the heart of the player it is just processing music data, and read from a continuous stream or a finite file makes little difference.

I suspect the design is that the player just plays, and that the thing adding music to the queue to be played is expected to be intelligent and know what kind of thing it is queuing and tell the skin (by setting item info).

I'm just the music library guy really, and I suspect you need to talk to player devs to see if communication of stream format type from player to skin is possible.
I've tested Player.IsInternetStream and it seems to work, but it can't distiguish between a live radio stream and stream of a recorded program.

Another comment, if I play the stream above in VLC, the duration is 0.0 and is not counting.