How do you get/set media volume (not ringtone volume) in Android?

private AudioManager audio; Inside onCreate: audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); Override onKeyDown: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; default: return false; } }

How do I change the volume of the sound or music in PyGame?

Changing the volume depends on whether you are playing a pygame.mixer.Sound object or playing the music via the pygame.mixer.music module. The volume of a Sound can be changed by set_volume(). The volume argument is a value in range [0.0, 1.0]: pygame.mixer.init() my_sound = pygame.mixer.Sound(‘my_sound.wav’) my_sound.play() my_sound.set_volume(0.5) The volume of the music can be changed by … Read more

How to control Windows system volume using JScript or VBScript?

The best way I can see for manipulating the system volume level on Windows without the need for installing additional software is to use VBScript in one of the following ways: Toggle muted: (already mentioned in a previous answer) Set WshShell = CreateObject(“WScript.Shell”) WshShell.SendKeys(chr(&hAD)) Increase volume level: Set WshShell = CreateObject(“WScript.Shell”) WshShell.SendKeys(chr(&hAF)) Decrease volume level: … Read more

Volume change listener?

Check out registerMediaButtonEventReceiver(ComponentName broadcastReceiver); Define a BroadcastReceiver that handles ACTION_MEDIA_BUTTON. The recieved intent includes a single extra field, EXTRA_KEY_EVENT, containing the key event that caused the broadcast. You can use this key event to get which key was pressed. EDIT: This is just a sample code. syntax errors may be there. // in onCreate of … Read more

Javascript: Can you read the systems volume?

I’m assuming you’re talking about Javascript in a browser environment. In this case, the answer is clear, short and simple: No. Clientside Javascript has no support for File IO operations. However, in some browsers you can breach that rule by setting browser specific options. For instance, calling a Webkit based browser with the command-line argument … Read more

What is the purpose of VOLUME in Dockerfile

A volume is a persistent data stored in /var/lib/docker/volumes/… You can either declare it in a Dockerfile, which means each time a container is started from the image, the volume is created (empty), even if you don’t have any -v option. You can declare it on runtime docker run -v [host-dir:]container-dir. combining the two (VOLUME … Read more

Mute Windows Volume using C#

Declare this for P/Invoke: private const int APPCOMMAND_VOLUME_MUTE = 0x80000; private const int WM_APPCOMMAND = 0x319; [DllImport(“user32.dll”)] public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); And then use this line to mute/unmute the sound. SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle, (IntPtr) APPCOMMAND_VOLUME_MUTE);