Sometimes, I want to listen to streams or videos while I'm on the go, but I can't put my phone in my pocket because that would press buttons on the display. Is there any way to turn the screen off and still let the stream/video running like it does with music players?
- Download MX Player
- Play YouTube/Sdcard video using MX Player.
- Press Menu button (or the 3 dot icon), and then select Play
- Make sure "Background Play" is checked
- Now, you can press Home Button and listen in lock screen.
There is also a shortcut for enabling Background Play, which is tapping and holding the Play button, instead of just tapping it to play a video
- Copied from my own answer on this post
If you are open to installing mod YouTube Vanced is the easiest way for getting background play feature and it works well for non-rooted Android too.