hslbck / gnome-shell-extension-radio

Gnome shell extension for listening to internet radio streams
GNU General Public License v3.0
144 stars 43 forks source link

Reconnect when network connection shifts #128

Open ilippert opened 5 years ago

ilippert commented 5 years ago

In my experience, the playback stops when I shift the system's connection, e.g. from ethernet to wifi.

hslbck commented 5 years ago

Currently I can't check this behaviour as I don't do network connection shifts.

Does this issue appear with other media players, e.g. lollypop and radio streams as well? Maybe it's not extension related

ilippert commented 5 years ago

thanks for the hint - yes, the playback stops also in Rhythmbox - do you know where to communicate this issue?

zapashcanon commented 5 years ago

It could be possible to fix it in the extension directly.

We just need to remember if the radio was playing. Then, when we have a network error and if the radio was playing, we could retry after a few seconds ?

hslbck commented 5 years ago

Should be possible to do it in the extension, but the gstreamer api has to be checked for the proper messages.

marekmosiewicz commented 2 years ago

Not sure, but maybe there is way to subscribe for dbus message for network reconnection.

Maybe this is helpful: https://stackoverflow.com/questions/59258931/how-to-use-dbus-and-networkmanager-to-activate-a-connection (this wan is to open connection, but maybe there is message which informs that connection was established

simeonfelis commented 1 year ago

As of gstreamer supporting network stream errors, here is some previous art:

https://coaxion.net/blog/2020/07/automatic-retry-on-error-and-fallback-stream-handling-for-gstreamer-sources/

A very common problem in GStreamer, especially when working with live network streams, is that the source might just fail at some point. Your own network might have problems, the source of the stream might have problems, …

Without any special handling of such situations, the default behaviour in GStreamer is to simply report an error and let the application worry about handling it. The application might for example want to restart the stream, or it might simply want to show an error to the user, or it might want to show a fallback stream instead, telling the user that the stream is currently not available and then seamlessly switch back to the stream once it comes back.

Implementing all of the aforementioned is quite some effort, especially to do it in a robust way. [...]

Since most radio stations probably use icecast, souphttpsrc is assembled with the playbin. This has a retry property:

https://gstreamer.freedesktop.org/documentation/soup/souphttpsrc.html?gi-language=python#souphttpsrc:retries

So when setting this to infinite (-1), the stream should restart until the user presses stop.