The YouTube app stops playing if you lock your phone. On Android, this is fairly simple to work around because the OS doesn’t have that many restrictions and apps can work around them. On iOS, the options are limited unless you jailbreak your phone but not many people jailbreak iPhones for just one little reason. For a while, you could use the mobile version of YouTube in a mobile web browser but that no longer works. That said, you still have two ways you can play YouTube from the lock screen on iOS.
YouTube mobile, when accessed in any other web browser, will stop playing videos when you lock your screen. The Dolphin browser is the exception. If you access YouTube mobile in Dolphin, you can lock your iPhone and then tap the Play button on your lock screen to start playing the video you selected.
In the event that Dolphin doesn’t work for you, you can try the Musi app. It’s free but has ads that can be removed with an in-app purchase. The Search tab lets you search YouTube for a video to play. You can’t exit the app but once the video is playing, you can lock your iPhone and it will continue to play.
The downside of using Musi is that you cannot play/pause the video that it’s playing from your lock screen. The app doesn’t connect with the music controls in the Control Center and it doesn’t add a player to the lock screen. Any time you want to pause the video, you will have to unlock your iPhone and use the app to pause it.
About two years ago, this worked in Opera as well. It seems browsers that are minimal and/or low on features can still play YouTube in the background. The Dolphin browser is light weight and won’t even try to open the YouTube app when you visit YouTube’s mobile version. The browser really is the better option to go with here but if it doesn’t work, look for other light-weight browsers and they may work.
Firefox and Chrome are not going to fit the bill. Neither will Safari.
Playing YouTube from the lock screen will definitely conserve battery. The app won’t be playing the video and since your phone is locked, the screen being off will also help save battery. If you’re wondering whether or not this is legal, it is. You’re good as long as you don’t download YouTube videos.