How to assign an application its audio output in Wireplumber?

How set up Wireplumber to always set a specific audio output for a given application (if that audio output is available of course)?

For example: I wish Spotify would always use USB headphones, and Firefox would play audio through the HDMI output.

I tried to find some information in the documentation and on Wireplumber’s Gitlab, unfortunately to no avail.

The simplest way is to install pavucontrol, open the application and change the audio output selection for the application. It should default to that afterwards.

You can look at ~/.local/state/wireplumber/restore_streams to see the changes.

As an example, I’ve got mpv set to play out of my headphones currently.

I’m guessing there is another way to do this but I haven’t found it yet.