Disable/pause audio when active playback device changes

Is there a way to enable a system-wide disable/mute switch for audio when the playback device changes (i.e. on an Android phone). Sometimes on the bus, my Bluetooth headset will disconnect from the phone, and VLC continues to play music loudly through the built-in speakers, which is embarassing for the user and annoying to other passengers.

Similarly, using “Smart Audiobook Player”, if the same thing happens, the family gets to listen to whatever I’m listening to during a Bluetooth disconnect until I manually unlock and stop playback 30 seconds later. Is there any reliable mechanism built into the OS to clamp down on this “feature”?