I've had tons of people asking me to do this....so here it is. Sorry if it's quiet! I got the script from the internet so if theres anyone else out there thats used it as well....sorry :( Thank you for listening, commenting and subcribing :)
To listen while using other apps, switch the player to Picture-in-Picture (PiP) during playback — it keeps playing in a small floating window (the screen stays on).
To listen with the screen fully off, in-browser playback stops by YouTube's design. Open the video in the YouTube app to keep listening where background playback is supported (e.g. with YouTube Premium).
Open in YouTube app