I use Firefox on Android as a background YouTube player. Just open Youtube on Firefox, select the video you want to watch, lock the screen. The video will stop, but if you press 'play' in the dialog you get in the lock screen, it'll start playing again.
The issue is that the YouTube webpage video player itself tries to detect when it is backgrounded - seemingly via both APIs and usage patterns - and will stop playback when it detects that. This is true on desktops as well.
There were extensions to disable this behaviour that thankfully work with Firefox for Android.