What to do if Spotify stops playing when the screen is locked
If you find the Spotify app on your mobile stops playing when the device screen sleeps or locks, you should try the below steps.
The “Sleeping apps” feature saves battery by preventing certain apps from running in the background. Check that Spotify has not been added to your “Sleeping apps” list.
Samsung’s default music widget is a pop-up toolbar that enables you to control media playing on your device. Deactivating it could solve the problem with Spotify.
“Optimise battery usage” monitors and restricts how much battery is used by some apps, in order to save power. These settings could be affecting Spotify. You can check the settings here:
Find Spotify, then tap the switch to deactivate "Battery optimisation".