Spotify Connect on OpenWrt?

Does anyone know of a package to enable OpenWrt to stream audio through Spotify Connect and a USB audio adapter?

If I'm not mistaken, this would be a closed source (predominantly smartphone) app, which makes it rather unsuitable to run on OpenWrt (first of all there is no JAVA/ dalvik VM in the OpenWrt repos (although that could be done) and accordingly neither any of its other runtime dependencies are met, given that OpenWrt is a constantly updated, moving target, dealing with any non-free/ sourceless addon packages would be difficult without heavy vendor buy-in (as in them keeping on the ball to provide updates in a timely fashion). ignoring the legal aspects).

Apart from this rather fundamental issue, doing this wouldn't exactly be a smart approach either. Yes, adding a USB soundcard is easy, but a media player needs a different update cadence (high profile security issues are common when accepting random external media to play) than that for router uses, this would benefit from a more agile base OS (daily in-place ugprades, et al). A network infrastructure device such as your router should to only one thing, its main task, locked down as much as possible, kept up to date as much as possible - adding non-routing features just adds a huge additional attack surface (which is very significant for a media player, a browser or anything that needs to interpret/ execute random input from the internet).

--
Yes, you will find earlier attempts to make OpenWrt a web-radio with USB soundcards in this forum - but there are fundamental differences. Neither of those have to deal with DRM and closed source software components, but get rather simple MP3/ AAC streams to play back, there are well known FOSS applications in the repos (mpd and ffmpeg codecs), updates come with the rest of OpenWrt - and these projects rarely use the routing capabilities of OpenWrt (but are rather just configured as wireless client behind another OpenWrt router).

There's nothing preventing you from running librespot with eg raspotify on OpenWrt. But building it is non-trivial due to the lack of a rust toolchain. You might be better off using something else than OpenWrt. See https://github.com/librespot-org/librespot/blob/master/COMPILING.md for building instructions.

I ran it on an RPi4 with Debian for a while. Worked fine. In theory it should work just as fine with OpenWrt, if you are able to build it.

slh, bmork,
Thanks for you replies. Good points. I will have a closer look at compiling librespot.

I think OwnTone can also play spotify streams. I've got OwnTone running on an x86 OpenWrt router and that works fine but I don't use spotify. The install requires quite a few dependencies so you will need enough free space on your device to be able to install it. I've no idea what the CPU requirements are but I would guess that you need a reasonable arm or x86 machine.

https://owntone.github.io/owntone-server/integrations/spotify/

Hi, I couldn't get Spotify Connect working with OwnTone, and including dependencies there is almost 14MB space requirement.

librespot is a good alternative. However, there is no librespot package for OpenWRT. It can be built manually for selected targets. Unfortunatelly, the cryptographic library ring doesnt support MIPS, which is an architecture used by most routers. However, ARM and x86 seem to work well. The resulting executable is 4.14 MiB big.

I added an example of how to build for ARMv7 / ipq40xx on the wiki: [OpenWrt Wiki] USB audio support

I was able to compile librespot for armv7 with this:
Cross compiling Rust binaries to ARMv7 | Modio