Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spotify to Broken Software #63

Open
benjamingwynn opened this issue Mar 5, 2023 · 9 comments
Open

Add Spotify to Broken Software #63

benjamingwynn opened this issue Mar 5, 2023 · 9 comments

Comments

@benjamingwynn
Copy link

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
Copy link

DavidBuchanan314 commented Mar 6, 2023

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:

  • shim the macos aarch64 widevine blobs (tricky, especially without breaking DMCA - you would need to "bypass" certain TPMs to make it run on a non-macos host environment)

  • shim the linux x86_64 widevine blobs running under QEMU/rosetta2 (tedious and fiddly, requiring a cross-arch interposer)

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
Copy link

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
Copy link

frigaut commented Mar 6, 2023

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
Copy link

DavidBuchanan314 commented Mar 6, 2023

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
Copy link
Author

@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
Copy link

mkurz commented Mar 7, 2023

...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
Copy link

DavidBuchanan314 commented Mar 7, 2023

@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
Copy link
Member

marcan commented Mar 11, 2023

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants