I am building an audio player, where the audio can be turned on and off. When the audio is on the volume control button on the phone properly controls the media volume.
However when the audio is off, the volume button controls the phone ringer volume.
Is it possible to configure the volume button such that it will control the media volume even when media is not playing?
In your activity's onCreate() you can do:
setVolumeControlStream(AudioManager.STREAM_MUSIC);
like described in How to control media volume?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With