Skip to content Skip to sidebar Skip to footer

Change Media Player Volume On Seekbar

I am working on a game application. But there is a problem on volume control. I want to change media player volume using a seekBar, and not system media volume. Is there any soluti

Solution 1:

May be this help...

protected static void setVolume(int volume) {
        currentVolume = volume;
        {
            if (volume == 1) {
                volume = 2;
            }
            try {
                float vol = ((float) volume / CONSTANT.SYSTEM_MAX_VOLUME);
                mediaPlayer.setVolume(vol, vol);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    }

Post a Comment for "Change Media Player Volume On Seekbar"