RasPi 4, Kali, pulseaudio, xrdp

A little bit of context: I’m configuring a RaspBerry Pi4 8GB with an Samsung T7 SSD as a portable travel desktop computer in conjunction with an iPad Pro 12" with MagicKeyboard which acts as GUI terminal. I can hook up the RasPi over USB-C networking, and power it from the iPad, and with xrdp and the Apple MagicKeyboard I have keyboard and mouse support.
I managed to get the pulse-audio-xrdp modules working, so for the most part, even audio input and output works using the iPad’s speakers and microphone. This makes for a decent desktop working environment, particularly when traveling.
Since this may not the only configuration, I also want to get Cantata/Mopidy working as a combination.

If I start mopidy as service, it latches on to the RasPi hardware audio, and doesn’t recognize the xrdp audio sink device. So to use the combination, I have to manually start mopidy from the shell, after logging in, and then launch Cantata.

This isn’t particularly pleasant, especially as I may want to use it also in other configuraitons, like e.g. hooking it up to a stereo with an audio cable.

Is there some way to configure mopidy to recognize new audio sinks as they become available, and allow connection to them?

Did you install pulseaudio on the pi? Are you configuring Mopidy to use pulsesink? Did you see the part on the docs about using pulseaudio and running Mopidy as a service?

Did you install pulseaudio on the pi?

yes, it’s fundamental for audio I/O over xrdp to work

Are you configuring Mopidy to use pulsesink?

I think so, it does show up in the pulse audio mixer.
The issue is that pulseaudio may be the issue here. For xrdp audio to work, it has to be started in user mode, not in system mode (otherwise it latches on to the audio hardware, and that’s that.
I guess what I would need from mopidy is the ability to attach to a pulse-audio user session as one becomes available.

Frankly my use case is to use Cantata with Mopidy as quasi iTunes replacement.
So ideally, whenever Cantata connects, it should connect to that user’s pulseaudio session, with whatever hardware or virtual devices that session provides. That would be the ideal scenario. Not sure if that can reasonably be achieved.

Did you see the part on the docs about using pulseaudio and running Mopidy as a service?

I saw some things, but I’m not quite sure how it applies, because of the requirements of xrdp audio. The xrdp audio sinks and sources, AFAIK only become available once an xrdp connection is established. So at boot time, these sinks don’t exist, and when they are created, they are in a pulseaudio user session.

I undestand I’m not exactly using a “traditional” setup…