Hi JefJ,
Additional information on the specific nature of your concern will be necessary to best advise on how to proceed.
You mention that you're playing music when the AirPods disconnect, but is that music played from an iPhone, Mac, the Apple Watch or something else?
If you use the AirPods and are not wearing the Apple Watch, do they function normally? What if you play music on the AirPods from the Apple Watch as described in Play music on Apple Watch?
One other possible factor is the automatic switching feature. Per Switch your AirPods to another device:
"Turn off automatic switching
If you don't want your AirPods to switch automatically, you can turn off automatic switching on your iPhone, iPad, Mac, or Apple TV.
On your iPhone or iPad
- With your AirPods in your ears and connected to your iPhone or iPad, go to Settings > Bluetooth. Alternatively, you can go to Settings > [your AirPods].
- Tap the More Info button
next to your AirPods in the list of devices. - Tap Connect to This iPhone [or iPad].
- Tap When Last Connected to This iPhone [or iPad].
- To turn on this feature again, tap Automatically."
Check to see if disabling that feature resolves the concern.
Regards.