More than likely the app you are u are using is going to sleep to conserve battery. Had the same problem. Go into device care < battery then find your app. Click on it and scroll down. Uncheck the "put app to sleep" option.
Hello @Samsung_etkBZV9 ,
Have you checked if the app you are using for music isn't listed in the sleeping apps list? You can find this list by going to settings, device care, battery, tap on the three dots on the upper right, settings, sleeping apps.