The fact that it works from Safari/YouTube, would indicate that AirPlay, on your Mac, is functioning properly ... at least, for that setup.
Why it doesn't work with those other apps, could be an incompatibility issue with either those apps or the speaker itself.
A number of steps occur to successfully stream audio using AirPlay. Obviously, one (or more) of those steps is (are) failing. Which one(s) would require that you can perform (& analyze) a data dump between your Mac and your AirPlay speaker. One tool for this is Wireshark. However, using this tool to capture data is relatively simple; actually analyzing the data is totally another thing all together.
Per chance, you run a software firewall on your Mac? AirPlay needs, at least, two networking protocols to work: IPv6 & mDNS. A firewall could be blocking one, or both, of these.
Is both your Mac and this speaker on the same wireless network subnet?