I had this problem and in my case solution was surprisingly stupid. Apparently I was connected to speaker on 2 devices. On pc, which was the music source, and on phone, which I used to browse reddit. Eventually I was stumbling on videos on reddit, and even without sound when you start looking at them, speaker stops playing sound on pc. So basically try checking for when exactly music stops and if it’s somehow related to what you are doing at the moment.