Last active
February 17, 2025 19:28
-
-
Save leso-kn/1f12d794df5bb1471aa7c2210f1e8669 to your computer and use it in GitHub Desktop.
Use WidevineCDM on musl (native musl-browsers, uses gcompat only on libwidevinecdm.so)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pulse=$(echo /tmp/pulse-*) | |
docker run --rm -ti \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix \ | |
-v /dev/dri:/dev/dri \ | |
-v /run/user/$(id -u)/pulse:/run/pulse \ | |
-v $pulse:$pulse \ | |
alpine \ | |
ash -c " | |
set -e | |
apk add firefox gcompat patchelf font-noto | |
# step 1: generate firefox profile | |
DISPLAY=:0 firefox -headless | while read lin; do pkill firefox; done | |
export ffprofile=\$(echo /root/.mozilla/firefox/*.default-release) | |
echo 'user_pref(\"media.eme.enabled\", true);user_pref(\"media.gmp-manager.updateEnabled\", true);' >> \$ffprofile/prefs.js | |
printf 'Installing widevine cdm' | |
# step 2: let firefox install Widevine | |
DISPLAY=:0 firefox -headless 'https://bitmovin.com/demos/drm' 2>/dev/null >/dev/null & | |
while ! stat \$ffprofile/gmp-widevinecdm/*/LICENSE.txt 2>/dev/null >/dev/null | |
do | |
printf '.' | |
sleep 1 | |
done | |
sleep 1 | |
pkill firefox | |
# step 3: patch firefox Widevine to import gcompat.so.0 (requires GMP-sandboxing to be disabled) | |
patchelf --add-needed /lib/libgcompat.so.0 \$ffprofile/gmp-widevinecdm/*/libwidevinecdm.so | |
MOZ_DISABLE_GMP_SANDBOX=1 DISPLAY=:0 firefox | |
ash | |
" |
@quadraplat Likely, yes! I belive chromium does not download libwidevinecdm.so
automatically and in the case of Google Chrome, the library is distributed together with the browser. For chromium the steps should be: https://github.com/proprietary/chromium-widevine
From there on this patch should work in the same way, like in the case of Firefox it may be required to disable some signature checks though, like Firefoxes GMP sandboxing
yea, probably the sandbox that is messing me up...
I can patch it just fine and place it the correct place, but cant get widevine content to play. would be super nice to not need to have a the same borwser installed twice just to watch netflix....
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
do you think an approach like this would/could work on chromium?