librespot-org / librespot-java

The most up-to-date open source Spotify client
Apache License 2.0
373 stars 90 forks source link

Spotify Connect does not show up with zeroconf #716

Open dolanjp opened 10 months ago

dolanjp commented 10 months ago

Describe the bug Spotify connect device does not show up on the network with librespot-java.

To Reproduce Download latest librespot player jar file Run with sudo java -jar librespot-player-1.6.3.jar Make sure ZEROCONF is used in config.toml - restart if needed

Expected behavior Zeroconf announcement should be visible on network and show up as Spotify Connect device in the app on devices connected to the same local network

Screenshots/Stracktraces/Logs This is in an Ubuntu VM with bridged networking and no firewall on the Ubuntu machine. I'm running into this same issue with both Spocon and the librespot-java player. I decided to try the original librespot and it works fine with zeroconf, the connect item shows up in the Spotify app and the announcement is visible on the network. Below are the ports and protocols used by librespot-java (java) and librespot respectively

image image

Attached are the outputs from Spocon and from librespot-java. I noticed that no addresses are listed in the announcement but I'm not sure if that's intended:

INFO Zeroconf:500 - Announced Service{alias='librespot-java', service='spotify-connect', port=45337, text={VERSION=1.0, CPath=/, Stack=SP}, addresses=[], domain='.local', protocol='tcp', host='Ubuntu-22'}

Version/Commit librespot-player-1.6.3.jar

Logs: librespot-java_output.txt Spocon_log.txt

dolanjp commented 9 months ago

I dug a bit further into the zeroconf-java repository and it looks like the IP addresses should be added, so I think this is the problem. I don't understand how everything going on with the zeroconf and service code, but somewhere along the chain there must be an issue with adding the addresses from my NIC.

https://github.com/devgianlu/zeroconf-java/tree/1c98d74ecccc2909b70b46a6113d8ba13bb23f93 src/main/java/xyz/gianlu/zeroconf/Zeroconf.java src/main/java/xyz/gianlu/zeroconf/Service.java

I've tried using all interfaces and entering specifically the "enp0s3" NIC into the config file with no luck. Here's the NIC info on my VM:

docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500

    inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255

    ether 02:42:ec:70:ca:eb  txqueuelen 0  (Ethernet)

    RX packets 0  bytes 0 (0.0 B)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 0  bytes 0 (0.0 B)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

    inet 192.168.1.220  netmask 255.255.255.0  broadcast 192.168.1.255

    inet6 fd25:3921:203e:41f5:4a53:e97a:4eab:1ecf  prefixlen 64  scopeid 0x0<global>

    inet6 fe80::bc80:5771:8d4f:c19  prefixlen 64  scopeid 0x20<link>

    inet6 fd25:3921:203e:41f5:e692:c505:d205:f7cd  prefixlen 64  scopeid 0x0<global>

    ether 08:00:27:85:9b:a9  txqueuelen 1000  (Ethernet)

    RX packets 1455773  bytes 2107724130 (2.1 GB)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 149006  bytes 14403116 (14.4 MB)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

    inet 127.0.0.1  netmask 255.0.0.0

    inet6 ::1  prefixlen 128  scopeid 0x10<host>

    loop  txqueuelen 1000  (Local Loopback)

    RX packets 1781  bytes 197796 (197.7 KB)

    RX errors 0  dropped 0  overruns 0  frame 0

    TX packets 1781  bytes 197796 (197.7 KB)

    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0