安装
测试环境:ubuntu 26.04.1
bash
sudo apt install shairport-sync alsa-utils
配置服务
需要配置到user session,否则pipewire会冲突。
bash
ethan@G5000:~$ cat ~/.config/systemd/user/shairport-sync.service
[Unit]
Description=Shairport Sync - AirPlay Audio Receiver (User)
After=pipewire-pulse.service
Requires=pipewire-pulse.service
[Service]
Type=simple
Restart=on-failure
ExecStart=/usr/bin/shairport-sync -c /etc/shairport-sync.conf
[Install]
WantedBy=default.target
ethan@G5000:~$ sudo systemctl disable shairport-sync.service
否则pipewire冲突,出现如下LOG
ethan@G5000:~$ sudo journalctl -u shairport-sync -f
9月 02 17:02:22 G5000 shairport-sync[19826]: fatal error: failed to connect to the pulseaudio context -- the error message is "Connection refused".
9月 02 17:02:22 G5000 systemd[1]: shairport-sync.service: Main process exited, code=exited, status=1/FAILURE
修改配置文件,使用pa后端,适应pipewire。
bash
ethan@G5000:~$ cat /etc/shairport-sync.conf | grep Ethan
output_backend = "pa"; // Added by Ethan
启动(开机启动)
bash
sudo systemctl daemon-reload
systemctl --user enable --now shairport-sync.service
常见问题
WiFi环境,播放卡顿
bash
ethan@G5000:~$ cat /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
[connection]
wifi.powersave = 2
将wifi.powersave = 3改成wifi.powersave = 2