I can't stream Web Radio

129 views
Skip to first unread message

Marc Peter

unread,
Oct 28, 2016, 1:06:47 PM10/28/16
to SoCo - Sonos Controller
Hi,

I have try this code to play web radio without success, can some one help me?

import soco

device
= soco.discovery.any_soco()

print(device)

zone
= device.group.coordinator

print(zone)

zone
.play_uri('http://rundfunk.ice.infomaniak.ch/rundfunk-192.mp3', title='Rundfunk FM')
Code hier eingeben...

Output:
/Users/mpeter/.pyenv/versions/3.4.4/bin/python3 /Users/mpeter/PycharmProjects/sonos/Play2.py
<SoCo object at ip 10.0.2.216>
<SoCo object at ip 10.0.2.215>

Process finished with exit code 0

But it's not work. No reaction in the Sonos Speakers.

Regards,

Marc


DPH

unread,
Oct 29, 2016, 6:03:45 AM10/29/16
to SoCo - Sonos Controller
Hi, tested your code and it displays on the Sonos controller:
"Unabable to play 'rundfunk-192.mp3' - the song is not encoded correctly."

So your program is working, but Sonos is unable to decode that mp3 stream. 

However, if you add this as a radio station in Sonos then it plays! (Manage / Add radio station.....)

So one way round is to use Soco to play a radio station you have stored.
But will also try to look what is different about how Sonos calls a stored radio station. 

Regards David

Kenneth Nielsen

unread,
Oct 29, 2016, 6:29:26 AM10/29/16
to SoCo - Sonos Controller
Hi Marc and DPH

@DPH This seems to be the same issue as #434 (https://github.com/SoCo/SoCo/issues/434). If you do some wiresharking, can you share it in the bug report as well?

Regards

DPH

unread,
Oct 29, 2016, 6:52:29 AM10/29/16
to SoCo - Sonos Controller
SOLVED:

Using wireshark the way Sonos calls this is using a prefix of 'x-rincon-mp3radio://'

So it works if you change http:// to the above. The below example works:

zone.play_uri('x-rincon-mp3radio://rundfunk.ice.infomaniak.ch/rundfunk-192.mp3', title='Rundfunk FM')


Cheers Daivd
Reply all
Reply to author
Forward
0 new messages