Hi Martijn,
Do you have extensions on your browser that you suspect could hijack the media keys even when the browsers are closed, specifically Google play music or other media player extensions? Please try disabling them if you have and see if that works
Another thing, try setting a default media player and see if that fixes the problem. Go to Settings > Apps > Default apps > Music then choose a player. Do the same with Videos and try setting VLC as default and see if that would work.
If still not working, since you mentioned that you have an external keyboard, try plugging it into another port and see if it's just a simple connection problem.
For Spotify, try toggling on/off the option "Show desktop overlay using media keys" in (...) > Edit > Preferences > Display