Play/Pause System Music

Hi, I am making an MIT App Inventor that connects my phone with an ESP32 via BLE.

I want to add this functionality:
when a button is pressed:
if any music on phone is playing (any other music player app)
Pause/play that music.

You can think of it as a simple bluetooth headphone , on which if I press the pause/play button, any music, be it youtube, music app etc, it pauses/plays.

Can we do something similar in MIT AI2?

If some other musiic is playing and you start playing music in your app, then theoretically the other music should stop automatically

Taifun