bablokb / pi-webradio

An Internet-Radio built around a Waveshare 7.9" Display
GNU General Public License v3.0
11 stars 3 forks source link

Encrypted https stream links cannot be played #1

Open collimas opened 2 years ago

collimas commented 2 years ago

Links like:

https://wdr-1live-live.icecastssl.wdr.de/wdr/1live/live/mp3/128/stream.mp3

are not played with the pi-webradio, unencrypted streams are ok.

I tested with Chromium and Firefox-ESR on latest RaspiOS with all updates installed.

bablokb commented 2 years ago

Yes, this is a limitation of mpg123 (you can pass the url on the commandline to mpg123 to verify this). I have checked the upstream project for changes on this issue, but I did not find a clear hint that this is solved in a newer version. If I find the time I will build a version of mpg123 from source to check.

I will leave this issue open until I document this limitation in the configuration-section of the readme.

collimas commented 2 years ago

Ok, a search took me to this page: https://www.linuxquestions.org/questions/linux-newbie-8/can-not-play-https-not-http-audio-stream-4175680407/

It seems piping a https url to mpg123 plays the stream:

curl -L https://stream.rcs.revma.com/ypqt40u0x1zuv -o pipe & mpg123 pipe

bablokb commented 2 years ago

This does not help, since mpg123 runs in "remote-control" mode (mpg123 -R). In this mode, the URL is passed to a running mpg123-instance with the LOAD or LOADLIST command.

One solution could be a special decrypting proxy, i.e. a proxy which communicates to the outside via HTTPS, and passes the datastream unencrypted back to the client. But this would probably also need support on mpg123 side.

collimas commented 2 years ago

Are there any alternatives for mpg123 ?

bablokb commented 2 years ago

vlc has nice python-bindings, but I decided against vlc because it does not provide callbacks for events, e.g. when new icy-meta data arrives. So one would have to constantly poll the state of vlc which is inefficient and complicated.

Theoretically it is possible to swap out the class SRMpg123.py and replace it with a vlc-implementation (the interface of SRMpg123 is agnostic about the specific implementation).

This will be something to think about as soon as radio-streams aren't anymore available unencrypted. But it would probably be simpler to change mpg123.