Android - Lock screen while playing YouTube video
- Download MX Player
- Play YouTube 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
Only For Rooted: You can install Xposed Modules Installer and use Repository called Youtube Background Play
The newest workaround doesn't require any new apps to be installed.
Follow these directions:
- Open Chrome browser.
- Navigate to the YouTube video you want to watch.
- Click the Chrome menu and select "Request Desktop Site".
- Play the video.
- Click the home button. The video will pause.
- Pull down the notification menu and play the video from there.
- You can now lock the screen.
This works without any fault as long as you keep the video playing. I played single videos for up to two hours without an issue. I noticed the following issues, which affect when I'll use this workaround:
If you pause the video from the notification, you will be able to play it again, but not if you leave it paused for too long. I didn't time it, but the notification control disappears in less than 30 minutes. You'd have to then open Chrome again and replay the video. The same is true if you pause the video with a blue tooth control.
If the video buffers because of a loss of connection, it will start again automatically, but only if it doesn't buffer for too long. Again, I did not time it, but I had issues after only a few minutes of lost connection, but that could have been related to item 3 below.
Switching from wifi to data or data to wifi connection often created a buffer issue. It always seems to auto play after a few seconds when going from wifi to data, but not when going from data to wifi. Data to wifi would take longer and sometimes not autoplay at all. I think this is because when the phone establishes the wifi connection, there's a delay in the ping back that lets apps know that connection has been reestablished. I noticed multiple times that autoplay would work within seconds of unlocking the screen.
After a video's end, autoplay doesn't always work. I found no pattern for when it would work.
On long videos that you might listen to parts of over several days, in addition to having to start the video from Chrome again between every break longer than an hour, you may also have to scrub to the time where you left off. Multiple times, it seemed Chrome would decide to reload the tab, making the video reload to the beginning. It seems to be more reliable if I leave Chrome open (but in the background), but it still occasionally reloads the tab. If you're fast enough, you can read your time as you open the tab before it reloads, making this only a simple nuisance.
I've been listening to a lecture series in a playlist this last week and these are the issues I've noticed. In light of the trouble I've had, I think I'll just download the MP3 from now on, but I'll use this hack method if there's just a single video that piques my interest in the moment. In other words, I recommend that if you have the time and desire to listen to a playlist, it's just easier to go through the steps to download the MP3.
A Touch Blocker app was the best option for me.