Does YouTube in Safari play in background/with the screen off?

I like "Vinegar - Tube Cleaner" for this.

It's not a perfect solution - I have occasionally noticed it leading to some buggy behaviour in the YouTube/YouTube Music sites using Safari, but nothing anywhere near as bad as using those websites without it!

The only odd behaviour I can call to mind was one time that it continued playing audio when I answered a phone call. It was easy to stop the music playing, and the other person on the call couldn't hear the music. I was actually disappointed that the other person couldn't hear the music, and I've been disappointed every time I've taken a phone call since and the music hasn't continued playing. I wish that was a feature :)

I think Vinegar was well worth the small one-time price, and I like supporting the developer. I've heard that Brave allows playing with the screen off, but I like my setup enough that I don't want to install Brave just for that.

I’m doing it right now. It does pause when you switch away from safari but you swipe down to get the control center and then resume play.

I use yPlayer for that, plus SponsorBlock