Reputation: 35
I am trying to create an app where you can listen to radio streams from your phone. Is this possible with Kivy?
I am building this app for my high school radio station. I've tried the SoundLoader but that didn't seem to work.
Here is the code I have for playing the live-stream.
class ListenWindow(Screen):
sound = SoundLoader.load('stream.mp3')
sound.play()
Here is the output I receive.
[WARNING] Deprecated property "<AliasProperty name=filename>" of object "<kivy.core.audio.audio_gstplayer.SoundGstplayer object at 0x03DFE378>" was accessed, it will be removed in a future version
[WARNING] [AudioGstplayer] b"No decoder available for type 'text/uri-list'."
[ERROR ] [AudioGstplayer] b'Your GStreamer installation is missing a plug-in.'
[INFO ] [Window ] Provider: sdl2
[ERROR ] [AudioGstplayer] b'Internal data stream error.'
I tried to update GStreamer through pip but this did not fix the problem.
Upvotes: 2
Views: 1480
Reputation: 163334
Icecast/SHOUTcast streams are essentially HTTP Progressive streams, where the media data is continually encoded, streamed to clients, and played back. When this type of streaming started, web browsers weren't able to play back the stream. Therefore, if you linked directly to the stream, the browser would continuously download a never-ending "file".
To get around this, M3U and PLS playlists were used. The idea being that in-browser, you can link to a playlist which was downloaded and subsequently opened in the user's media player. The media player reads the playlist, finds the actual URL to the stream, and then makes its own HTTP request to the stream and plays it.
When you're using something like Gstreamer, to play the stream you need to use the actual stream URL. That is, you need to parse the M3U or PLS playlist file yourself, find the stream URL, and then open it. In your case, since you know that you're only working with one station, you can just open that playlist in a text editor to find the stream URL.
Upvotes: 1