The only way to listen in the background on all browsers is via skipvids.com

For android and desktop, it's automatic when you lock your screen.

For the latest ios they have a Pip and audio mode button.