Generally speaking, you can't do much with Android OS BUT for Samsung devices, there's an amazing solution
Download Samsung Sound Assistant
Go to Control Audio, enable Dual app sound and then select your favorite Music app
And voila! your app won't pause and notifications will be play along your music without even lowering the volume of music
Same problem just a few minutes ago on S7 edge... it's not just on s9 or s8
The music was stopping and then starting again every second.. and then when it stopped the Google assistant showed up... this was very frustrating so I deactivate Google and put my phone on airplane mode because I thought that one app was doing this over the internet. And it didn't work.. so idk
I had this issue with audible. It kept shutting down everytime the screen went to sleep. The only way to listen to audible was to put car mode on and force the screen to stay on which drains the battery.
I found an option in battery settings. "Sleeping Apps" Basically any app in this section won't work when the phone screen shuts down. I removed audible from the list and fixed the problem. It now works
Just an FYI my S9 plus music player started stopping after half of a song played. I finaly figured out my issue related to play lists. I deleted all my playlists and created new lists. This resolved my issue.
I am having the same issue but I have a Samsung A8 (2018) updated to the very latest software update (within the last couple of days) although now this update breaks Bluetooth so another issue.
Ok back to this one though, I have tried around 5 music player apps and all do the same, randomly stop playing but strangely it will only do this when I have placed my phone in my pockets, I have checked phone locks etc etc to see if anything has knocked the stop/play button etc but nothing, when the phone is out of my pocket, I have not noticed it stopping, like I said I have checked, pulled phone out, checked all buttons to see if anything could press a button or knock the play button but the phone remains locked (even volume keys are fine and at the same volume) its frustrating as it was working perfectly before the previous update (Pie 9)