android – Switch between media playing apps by pressing physical button


Recommend me some existing app(s) that can do it, or how to write it myself.

There can be many media players opened the same time. Only one can play. They all have items in the notification area, each on which has at least play/pause button, and often next and prev buttons. When you listen to one app and press another app’s play button, this app gets audio focus and starts playing, previous app pauses.

The interface I want: I press a button (e.g. HOME, I have it on my device) while listening to a stream in browser and it pauses and media player starts playing. I press it again and a podcast client or a TTS frontend starts playing.

How to give audio focus to the next app? Something like tab button for normal focus in forms on desktop.

The end target is to change audio sources without looking at the screen. I want to listen to different apps when I’m going to sleep. So I want functionality like on physical player – press a button and switch between tape and radio for example.

For all other actions there are button remapping apps and external bluetooth speakers with buttons and bluetooth or usb keypads or gamepads. The only thing I don’t know is how to make play not the most recent app, but another app.



Source link

Related Posts

About The Author

Add Comment