Code example for MediaPlayer

Methods: setVolume

0
            player.setVolume(VOLUME_OFF, VOLUME_OFF);
        } else if (callState == TelephonyManager.CALL_STATE_RINGING) {
            Log.v(TAG, "Someone is calling! Let's decrease volume.");
            player.setVolume(RINGING_VOLUME, RINGING_VOLUME);
        } else { 
            player.setVolume(1f, 1f);
        } 
    } 
 
} 
Experience pair programming with AI  Get Codota for Java