FirefoxPWA: DRM not working when launched thru .desktop entry

I’ve spent multiple hours trying to debug this but I can’t really get anywhere.

Basically, I recently installed firefoxpwa to run some websites as PWAs—most notably
Apple Music. I’ve followed all the required steps to get it to run i.e.

programs.firefox = {
  enable = true;
  nativeMessagingHosts.packages = [ pkgs.firefoxpwa ];
  package = pkgs.firefox;
};

environment.systemPackages = with pkgs; [
  firefoxpwa
];

I’m not using the home-manager modules for either firefox or firefoxpwa.

When I launch the PWA thru the extension in Firefox everything works perfectly and as expected i.e. audio works, DRM shenangians are all fine. However, when I launch the PWA thru its desktop entry I get the following errors in browser console:

And no audio at all. The songs won’t even load. Thinking it might be something with Apple Music acting weird as a PWA, I tried Crunchyroll but the same issue occurs—i.e. launching thru the extension in Firefox everything works good, but not thru the .desktop entry. I get no audio, however, video works perfectly fine and the episodes load. Anyone have a clue as to what’s going on and how I could fix this?

Here’s the .desktop entry for Apple Music which was generated by firefoxpwa:

[Desktop Entry]
Type=Application
Version=1.4
Name=Apple Music
Comment=
Keywords=;
Categories=GTK;;
Icon=FFPWA-01KZB3QK88EZQ7352W3PGHF0BP
Exec=firefoxpwa site launch 01KZB3QK88EZQ7352W3PGHF0BP --protocol %u
Actions=
MimeType=
Terminal=false
StartupNotify=true
StartupWMClass=FFPWA-01KZB3QK88EZQ7352W3PGHF0BP

And my system information:

 - system: `"x86_64-linux"`
 - host os: `Linux 7.1.6, NixOS, 26.11 (Zokor), 26.11.20260804.e72e4f2`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.34.8`
 - nixpkgs: `/nix/store/ysmvzxkvfyzjix8llqsvjiwnhfl5kpyf-source`

Ran into this issue too. This symptom has been reported already with an issue (firefoxpwa: Error no decoder found for audio/mp4a-latm · Issue #505426 · NixOS/nixpkgs · GitHub). The proposed solution still works with the latest nixos-unstable commit.

I looked into firefox/firefox-unwrapped/wrapper but today is my first time working with firefoxpwa so I’ve not gathered enough understanding yet for a proper fix.

The fix works perfectly on my end. Thanks!!

Hopefully this should work, and be a more elegant solution:

2 Likes