AsahiLinux / docs

Hardware and software docs / wiki
Other
1.77k stars 48 forks source link

Add Spotify to Broken Software #63

Open benjamingwynn opened 1 year ago

benjamingwynn commented 1 year ago

Spotify does not currently have an Aarch64 build, and as far as I'm aware it doesn't work in the browser due to a lack of widevine.

There is a thread tracking this on Spotify here: https://community.spotify.com/t5/Closed-Ideas/Desktop-ARM-linux-version-of-spotify-app/idi-p/5274705

This should probably be added to the broken software list on the wiki

DavidBuchanan314 commented 1 year ago

fyi spotifyd works nicely, but you will need to use another device to run the "controlling" session.

If you can make the browser pretend to support widevine, perhaps you could use a web session to control a local spotifyd instance.

I have been pondering a solution to the "widevine on aarch64 linux" issue at large - Google does not produce aarch64 builds of widevine for linux (nobody seems to know why).

Potential options are:

The second option is by far the most viable. Widevine interposers already exist (this is doable without any DMCA violations since the "Library CDM Interface" is public), so you'd "just" need to write a cross-architecture IPC shim mechanism to proxy calls between an aarch64-world library interface, and an x86_64-world CDM instance (running under QEMU usermode emu, or rosetta2). There may be 4k page size issues somewhere along the way, hopefully those are workaround-able without resorting to a 4k kernel.

A third option is to run the arm32 linux widevine blobs under qemu.

Edit: as of about a month ago, an aarch64 widevine cdm became available for certain chromebooks https://gist.github.com/ruario/19a28d98d29d34ec9b184c42e5f8bf29?permalink_comment_id=4464700#gistcomment-4464700 - I will try to get this running under asahi and report back

DavidBuchanan314 commented 1 year ago

I now have spotify working via the web interface, combined with a local spotifyd instance for actual playback: image

I wrote this userscript to fake the presence of widevine: https://gist.github.com/DavidBuchanan314/4ba4cf1018c616b33bc2d3c8b68ddb84

Obviously it won't work if you try to play something within the browser, but if you select your spotifyd instance as a playback device first then it'll work.

frigaut commented 1 year ago

either that, or you can use a client like spotify-tui, which I am using right now to play music in combination with spotifyd. Works good. Very low cpu usage too :-)

DavidBuchanan314 commented 1 year ago

I now have widevine + spotify web working on asahi, I'll document how I set it up soon (it's quite a convoluted process...)

Edit: https://gist.github.com/DavidBuchanan314/c6b97add51b97e4c3ee95dc890f9e3c8

benjamingwynn commented 1 year ago

@DavidBuchanan314 this is amazing work and I can't wait to try this out! I could foresee myself writing this as an AUR package or something, until official support comes along.

Another idea I had, not sure how feasible it is or whether it would work or not, is to use the patched Rosetta 2 Linux executable with the x86 spotify package. I know Spotify just runs a browser underneath, even on desktop, but I'm not sure if that plugs into Widevine and Widevine can't be used with Rosetta, or what the deal is there exactly.

@frigaut 100% a TUI is better than nothing, but I often find myself itching to see some beautiful album art ;)

mkurz commented 1 year ago

...to use the patched Rosetta 2 Linux executable...

Wait, what? there is a patched Rosetta 2 Linux executable that runs on Asahi's 16kb page size?

DavidBuchanan314 commented 1 year ago

@DavidBuchanan314 this is amazing work and I can't wait to try this out! I could foresee myself writing this as an AUR package or something, until official support comes along.

Another idea I had, not sure how feasible it is or whether it would work or not, is to use the patched Rosetta 2 Linux executable with the x86 spotify package. I know Spotify just runs a browser underneath, even on desktop, but I'm not sure if that plugs into Widevine and Widevine can't be used with Rosetta, or what the deal is there exactly.

I'm currently talking to the maintainer of the widevine-aarch64 AUR package about incorporating my script into the package. RE: "official support", that's probably never going to happen. IIUC, the only publicly available widevine builds for Linux arm (armv7 or aarch64) are ones extracted from Chromebooks, which will always require a certain amount of hackery to run on non-chromeos devices. (edit: I now realise you probably meant official-spotify not official-widevine - in which case yes, fingers crossed, they might support it eventually)

I might look into making spotify work under rosetta too, although it would probably be a massive pain. I'd need to apply similar 16k alignment patches to the spotify binary, and any other libs it needs to load. Spotify desktop does indeed incorporate widevine, but I think it's only used some of the time (podcast videos?) - Spotify uses their own in-house "DRM" system for normal music playback.

marcan commented 1 year ago

Just to go back to the original issue here: "Broken software" is for software that has issues. Software not available for arm64 at all does not qualify, since there is a huge amount of such software.

What we might want is to have a different list for popular apps without arm64 versions, and alternatives (like Spotify and Discord), but that's different from "Broken software".

benjamingwynn commented 1 year ago

Agreed, if you add a new section to the wiki or something I can change the title of this issue