This guide is primarily demonstrated on an Android phone, although the same method can be applied to Android tablets.
For iOS/iPadOS users, a similar method can be used as described in this post.
Let’s get started
First, open Youtube Music homepage on Chrome browser (most devices with built-in Google Play services should have it, if not, you can download it here) and do not play any music yet. Click the three dots on the top right corner and check “Desktop site”.
Next, play any song you like.
Once the music starts playing, you can go back to your home screen, lock your screen, or switch to other apps and you will find that the music continues playing. You can control playback, pause, and skip tracks in the notification center.
From now on, just open Youtube Music on Chrome and switch to desktop site to listen to music with background playback. This method also works for Youtube too!
The author has tested this method on several brands of Android phones and has not encountered any issues.