CCCPaste

Android Shell ADB Audio Volume Control

#Android Shell ADB Audio Volume Control

#list help options
media

#loop throw devices
for s in $(seq 0 20);
do 
  media volume --stream $s --get 2>/dev/null|grep -v "Connecting to AudioService"|grep -v "will get volume";
  echo "---------";
done

###HELP OUTPUT###
usage: media [subcommand] [options]
       media dispatch KEY
       media list-sessions
       media monitor 
       media volume [options]

media dispatch: dispatch a media key to the system.
                KEY may be: play, pause, play-pause, mute, headsethook,
                stop, next, previous, rewind, record, fast-forword.
media list-sessions: print a list of the current sessions.
media monitor: monitor updates to the specified session.
                       Use the tag from list-sessions.
media volume:  the options are as follows: 
                --stream STREAM selects the stream to control, see AudioManager.STREAM_*
                                controls AudioManager.STREAM_MUSIC if no stream is specified
                --set INDEX     sets the volume index value
                --adj DIRECTION adjusts the volume, use raise|same|lower for the direction
                --get           outputs the current volume
                --show          shows the UI during the volume change
        examples:
                adb shell media volume --show --stream 3 --set 11
                adb shell media volume --stream 0 --adj lower
                adb shell media volume --stream 3 --get