When all of my web browsers suddenly stopped playing YouTube videos properly, I actually got so frustrated that I flipped back to Windows for a while. Windows, in turn, frustrated me enough to work on the problem some more.
The issue was that videos would work upon opening the browser, but eventually would not play at all. I could force the issue to present itself by trying to play a video in private browsing; videos would not play in this mode, and after attempting it, would not play in normal mode either. I tried other browsers and nothing worked, so I knew it was a system problem.
Oddly enough, the cause turned out to be PulseAudio. I found several Reddit posts (including this one) that suggested replacing it with PipeWire would fix it. At first I wrote this off as ridiculous, but I tried it anyway, and everything went back to normal.
On Arch-based distros:
pacman -S pipewire-pulse
You might need to work through some conflicts with your package manager.
PipeWire is supposedly better than PulseAudio anyway, so don’t be afraid to try this. I have had no issues with audio since doing this.