Make sure the music player and gallery app are not set to auto end after going into sleep mode. Also, if you are using maximum battery saver mode, that might be turning it off as well. Change to one of the other battery profiles which doesn't turn off data. I had this same problem and did the things I mentioned and haven't had a problem since