Adjust audio volume from your app

Published: 19 December 2021
on channel: Sanjeev Kumar
834
28

This video shows how to adjust audio volume in Sketchware android project.

Get the codes here:
http://www.sketchwarehelp.com/2017/11...

Define AudioManager:
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

Get Max Volume:
int max_volume = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);

Get Current Volume:
int current_volume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);

Set Volume to 70%:
int volume70 = (int) max_volume * 7 / 10;
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume70, 0);

Mute audio:
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_MUTE, 0);

Unmute audio:
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE, 0);


Watch video Adjust audio volume from your app online without registration, duration hours minute second in high quality. This video was added by user Sanjeev Kumar 19 December 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 834 once and liked it 28 people.