Raspotify/Librespot连接Spotify Connect后立即断开的问题求助
Raspotify/Librespot连接Spotify Connect后立即断开的问题求助
大家好,我在树莓派3上安装了raspotify,想实现用手机的Spotify Connect把音频输出到树莓派外接的音箱,安装步骤如下:
curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo tee /usr/share/keyrings/raspotify-archive-keyrings.asc >/dev/null echo 'deb [signed-by=/usr/share/keyrings/raspotify-archive-keyrings.asc] https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list sudo apt install raspotify
安装过程看起来一切正常,之后我在/etc/raspotify/conf里设置了LIBRESPOT_NAME="pi_spotify"并重启了树莓派。现在手机Spotify的「设置/连接设备」里能看到这个设备,点击后也显示连接成功,但播放会立刻暂停,音箱完全没声音;再点播放按钮,pi_spotify就直接断开连接了。
另外,树莓派本身的音频功能是正常的——我通过SSH登录后执行aplay /foo/bar.wav,音箱能正常播放音频。
我查了系统日志,先执行了journalctl --system | grep spotify,输出如下:
Jan 17 09:45:07 raspberrypi systemd[1]: Started raspotify.service - Raspotify (Spotify Connect Client). Jan 17 09:45:07 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Deactivated successfully. Jan 17 09:45:07 raspberrypi systemd[1]: Finished raspotify-crash-report-generator.service - Raspotify Crash Report Generator. Jan 17 09:45:07 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Consumed 1.697s CPU time. Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:4070 Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:443 Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Failed with result 'exit-code'. Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Triggering OnFailure= dependencies. Jan 17 09:45:20 raspberrypi systemd[1]: Starting raspotify-crash-report-generator.service - Raspotify Crash Report Generator...
看起来服务启动后很快就失败了,后来我又尝试了journalctl -u raspotify.service -b,得到了更详细的日志:
Jan 17 09:45:07 raspberrypi systemd[1]: Started raspotify.service - Raspotify (Spotify Connect Client). Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:4070 Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:443 Jan 17 09:45:20 raspberrypi librespot[4364]: Failed to get home directory. Jan 17 09:45:20 raspberrypi librespot[4364]: [2024-01-17T09:45:20Z ERROR librespot_playback::player] Audio Sink Error Connection Refused: <AlsaSink> Device default May be Invalid, Busy, or Already in Use, ALSA> Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Failed with result 'exit-code'. Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Triggering OnFailure= dependencies. Jan 17 09:45:32 raspberrypi systemd[1]: Started raspotify.service - Raspotify (Spotify Connect Client).
这里我注意到两个关键错误:Failed to get home directory和ALSA音频输出的连接拒绝错误,但我用speaker-test -t wav -c 2测试ALSA是正常的,音箱能播放测试音。有没有大佬知道这两个错误是否相关?或者该怎么解决连接后立刻断开的问题?
备注:内容来源于stack exchange,提问作者spraff
相关产品推荐
相关产品推荐

