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"?
You can achieve it with Macrodroid by creating macros to pause apps such as VLC.


Open the app, select Add Macro.
Under the Connectivity section, select Headset Insert/Remove, then choose Headphones Removed. Click OK.
Go to Actions tab, under the Media section, select Control Media, select Simulate Media Button, click OK, then select Pause. Click OK and select the app you want to mute/pause. Click check the check mark button on the bottom right, give the macro a name.


When completed, the macro will look like the image below (there are 2 Media Pause because 2 apps where selected).



A solution to disable sound only for VLC if you are unable to use the steps described above: 


Open VLC, go to Settings, then to Extra settings, click on Audio.
Go to Headset section, enable Detect headset.


Note: I didn't test it with a Bluetooth headset.