Android - Stop notifications from briefly lowering media volume
Updated Answer
I first thought that the OP was asking about modifying the behavior of the sources of the notifications which can be done in with finer levels than before using Notification Categories in Android 8.0 Oreo.
However via the comments, it appears that the OP wants to stop Audio Ducking from happening in the media player. Unfortunately this is a feature of the media app playing the music itself and requires the developer of the app to configure. See similar question: Prevent music volume from being lowered when using turn-by-turn navigation
Original Answer
In Android 8.0 Oreo the App can now have Notification Categories
Check the notification setting screen in:
Settings->Apps & Notification->[App Name]->App Notifications
For the App(s) that are interrupting see if you can either disable sound or adjust the priority to one which suits your needs.