mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.06k stars 567 forks source link

[Problem]: MQTT Remote Control does nothing #1858

Open tomm1ed opened 1 month ago

tomm1ed commented 1 month ago

What happened?

Installed latest dev version and connected to MQTT server Sending [mqtt topic]/remote play etc does nothing, I see nothing in the logs of shairport-sync confirming that it is processing the commands (and nothing happens so it seems to ignore it)

Relevant log output

shairport-sync -v
         0.002415677 "shairport.c:2278" Startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "b8:27:eb:52:1f:1e".
         0.000163541 "shairport.c:2317" Version String: "4.3.3-dev-82-g2ec6068b-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc"
         0.000029636 "shairport.c:2336" Command Line: "shairport-sync -v".
         0.000490104 "shairport.c:2372" Log Verbosity is 1.
         0.000070729 "audio_alsa.c:1022" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000060677 "audio_alsa.c:1311" alsa: disable_standby_mode is "never".
         0.000023281 "audio_alsa.c:1315" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000022605 "audio_alsa.c:1317" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000033281 "audio_alsa.c:1357" alsa: output device name is "default".
         0.000237760 "shairport.c:2440" disable_resend_requests is off.
         0.000031823 "shairport.c:2441" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000026406 "shairport.c:2445" statistics_requester status is 0.
         0.000025625 "shairport.c:2450" rtsp listening port is 7000.
         0.000022084 "shairport.c:2451" udp base port is 6001.
         0.000021823 "shairport.c:2452" udp port range is 10.
         0.000021875 "shairport.c:2453" player name is "Livingroom".
         0.000022083 "shairport.c:2454" backend is "alsa".
         0.000021667 "shairport.c:2455" run_this_before_play_begins action is "(null)".
         0.000022395 "shairport.c:2456" run_this_after_play_ends action is "(null)".
         0.000022396 "shairport.c:2457" wait-cmd status is 0.
         0.000021823 "shairport.c:2458" run_this_before_play_begins may return output is 0.
         0.000022552 "shairport.c:2459" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000022813 "shairport.c:2461" run_this_before_entering_active_state action is  "(null)".
         0.000022396 "shairport.c:2463" run_this_after_exiting_active_state action is  "(null)".
         0.000022552 "shairport.c:2465" active_state_timeout is  10.000000 seconds.
         0.000027031 "shairport.c:2466" mdns backend "(null)".
         0.000021823 "shairport.c:2468" interpolation setting is "auto".
         0.000022187 "shairport.c:2472" interpolation soxr_delay_threshold is 30000000.
         0.000022813 "shairport.c:2473" resync time is 0.050000 seconds.
         0.000023281 "shairport.c:2474" resync recovery time is 0.100000 seconds.
         0.000023802 "shairport.c:2475" allow a session to be interrupted: 0.
         0.000022031 "shairport.c:2476" busy timeout time is 0.
         0.000021719 "shairport.c:2477" drift tolerance is 0.002000 seconds.
         0.000023281 "shairport.c:2478" password is not set.
         0.000021928 "shairport.c:2479" default airplay volume is: -24.000000.
         0.000025260 "shairport.c:2480" high threshold airplay volume is: -16.000000.
         0.000024948 "shairport.c:2482" check for higher-than-threshold volume for new play session is disabled.
         0.000022656 "shairport.c:2488" ignore_volume_control is 0.
         0.000022083 "shairport.c:2492" volume_max_db is not set
         0.000021407 "shairport.c:2493" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000023229 "shairport.c:2495" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000023542 "shairport.c:2499" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000023177 "shairport.c:2501" disable_synchronization is 0.
         0.000021823 "shairport.c:2502" use_mmap_if_available is 1.
         0.000021875 "shairport.c:2503" output_format automatic selection is enabled.
         0.000022656 "shairport.c:2507" output_rate automatic selection is enabled.
         0.000022187 "shairport.c:2511" audio backend desired buffer length is 0.200000 seconds.
         0.000024323 "shairport.c:2513" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000024271 "shairport.c:2515" audio backend latency offset is 0.000000 seconds.
         0.000023698 "shairport.c:2517" audio backend silence lead-in time is "auto".
         0.000022031 "shairport.c:2521" zeroconf regtype is "_raop._tcp".
         0.000022344 "shairport.c:2522" decoders_supported field is 1.
         0.000021979 "shairport.c:2523" use_apple_decoder is 0.
         0.000021771 "shairport.c:2524" alsa_use_hardware_mute is 0.
         0.000021979 "shairport.c:2528" no special mdns service interface was requested.
         0.000060156 "shairport.c:2531" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000026563 "shairport.c:2538" metadata enabled is 1.
         0.000022396 "shairport.c:2539" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000022916 "shairport.c:2540" metadata socket address is "(null)" port 0.
         0.000022552 "shairport.c:2542" metadata socket packet size is "500".
         0.000022292 "shairport.c:2543" get-coverart is 1.
         0.000021771 "shairport.c:2546" mqtt is enabled.
         0.000021354 "shairport.c:2547" mqtt hostname is 192.168.11.23, port is 1883.
         0.000022656 "shairport.c:2548" mqtt topic is shairport/livingroom.
         0.000021771 "shairport.c:2549" mqtt will not publish raw metadata.
         0.000022188 "shairport.c:2550" mqtt will publish parsed metadata.
         0.000022343 "shairport.c:2551" mqtt will publish cover Art.
         0.000022605 "shairport.c:2552" mqtt remote control is enabled.
         0.000021718 "shairport.c:2561" loudness is 0.
         0.000021615 "shairport.c:2562" loudness reference level is -20.000000
         0.000199375 "rtsp.c:4235" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.000811979 "mqtt.c:252" Initialising MQTT
         0.004326615 "shairport.c:2689" NQPTP is online.
         1.499888853 "shairport.c:255" "soxr" interpolation has been chosen.

MQTT log:
mosquitto_sub -h 192.168.11.23 -v -t "shairport/#" | ts
May 28 08:52:00 shairport/livingroom/service_name Livingroom
May 28 08:52:00 shairport/livingroom/output_frame_rate 44100
May 28 08:52:00 shairport/livingroom/output_format S16_LE
May 28 08:52:43 shairport/livingroom/remote play
May 28 08:53:31 shairport/livingroom/remote pause
May 28 08:53:32 shairport/livingroom/remote nextitem
May 28 08:53:35 shairport/livingroom/remote volumeup
May 28 08:53:36 shairport/livingroom/remote volumedown

System Information.

Raspberry Pi 3B running RaspberryPi OS Bullseye HifiBerry DAC+

uname -a Linux livingroom 5.15.76-v7+ #1597 SMP Fri Nov 4 12:13:17 GMT 2022 armv7l GNU/Linux

shairport-sync -V 4.3.3-dev-82-g2ec6068b-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc

aplay -l List of PLAYBACK Hardware Devices card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 [HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0

Configuration Information.

shairport-sync --displayConfig
>> Display Config Start.

From "uname -a":
 Linux livingroom 5.15.76-v7+ #1597 SMP Fri Nov 4 12:13:17 GMT 2022 armv7l GNU/Linux

From /etc/os-release:
 Raspbian GNU/Linux 11 (bullseye)

From /sys/firmware/devicetree/base/model:
 Raspberry Pi 3 Model B Rev 1.2

Shairport Sync Version String:
 4.3.3-dev-82-g2ec6068b-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc

Command Line:
 shairport-sync --displayConfig

Configuration File:
 /etc/shairport-sync.conf

Configuration File Settings:
 metadata :
 {
   enabled = "yes";
   include_cover_art = "yes";
   cover_art_cache_directory = "";
   pipe_name = "/tmp/shairport-sync-metadata";
   pipe_timeout = 5000;
 };
 mqtt :
 {
   enabled = "yes";
   hostname = "192.168.11.23";
   port = 1883;
   username = "username";
   password = "password";
   topic = "shairport/livingroom";
   publish_parsed = "yes";
   publish_cover = "yes";
   enable_remote = "yes";
 };

>> Display Config End.
>> Goodbye!

PulseAudio or PipeWire installed?

How did you install Shairport Sync?

Built from source

Check previous issues

mikebrady commented 1 month ago

Thanks for the post. Unfortunately, this seems to be due to a change at the player (e.g. the Music app). The issue is that some changes have occurred in recent versions of iOS and Mac such that the players don't respond to the remote control commands being sent by Shairport Sync. It's not just confined to Shairport Sync either -- it seems to be a general problem.

tomm1ed commented 1 month ago

Thanks for the post. Unfortunately, this seems to be due to a change at the player (e.g. the Music app). The issue is that some changes have occurred in recent versions of iOS and Mac such that the players don't respond to the remote control commands being sent by Shairport Sync. It's not just confined to Shairport Sync either -- it seems to be a general problem.

Ouch that sucks... Was looking forward to put a Hue tap in the shower to be able to pause music, skip a track and change the volume. TvOS 17.5 is already out and Apple appears to have done nothing it seems. Is there any way I can help to troubleshoot?

mikebrady commented 1 month ago

Thanks, yeah, it is a pity alright, but it may be that Apple are simply moving on, removing obsolete (to them!) features. IOW, it might not be a "bug" to them...

The real problem is that the protocols for their remote control and general supervision are (to my knowledge) unknown. If progress could be made there, it would give us a way to move forward.

tomm1ed commented 1 month ago

Thanks, yeah, it is a pity alright, but it may be that Apple are simply moving on, removing obsolete (to them!) features. IOW, it might not be a "bug" to them...

The real problem is that the protocols for their remote control and general supervision are (to my knowledge) unknown. If progress could be made there, it would give us a way to move forward.

Yeah the weird thing is that pausing the specific shairport-sync speaker from Apple Shortcuts on my iPhone (iOS 17.5.1) works without problem.

@mikebrady Just so I am understanding correctly; the fact that shairport-sync does not log anything when I post /remote play etc on MQTT is by design?

mikebrady commented 1 month ago

Yeah the weird thing is that pausing the specific shairport-sync speaker from Apple Shortcuts on my iPhone (iOS 17.5.1) works without problem.

Could that be because the shortcut is talking directly to the Music app on the iPhone?

Just so I am understanding correctly; the fact that shairport-sync does not log anything when I post /remote play etc on MQTT is by design?

It is by design, though it could easily be changed. The question is whether it might just fill up the log...

tomm1ed commented 1 month ago

Yeah the weird thing is that pausing the specific shairport-sync speaker from Apple Shortcuts on my iPhone (iOS 17.5.1) works without problem.

Could that be because the shortcut is talking directly to the Music app on the iPhone?

I am gonna test this when I have the time. The shortcuts targets a specific shairport-sync player. Gonna start a stream from my iPad and then run the shortcut from my iPhone. NB this only works since I updated from 1.1.1 (which has been running amazingly but was missing the 'remote control' part) to the latest dev version. (Was already running dev since back then only dev supported AirPlay2)

Just so I am understanding correctly; the fact that shairport-sync does not log anything when I post /remote play etc on MQTT is by design?

It is by design, though it could easily be changed. The question is whether it might just fill up the log...

No worries, was just wondering if shairport-sync was even registering the remote commands