How to keep playing online videos when screen is locked?
You can try to use an alternative to the default YouTube app, a popular choice being NewPipe. Although I haven't tested this myself yet, one of the listed features is being able to play videos in the background - even just the sound, without having to waste battery by displaying something you dom't actually care about.