Keyboard.press() presses a key and “holds it down” until a Keyboard.release() or releaseAll() is issued. That is, Keyboard.press() isn't appropriate for simulation of just tapping and releasing a key, unless you follow it with a delay and a release.
Also see Keyboard.write(). But note the following, from Keyboard.write()'s documentation:
Only ASCII characters that are on the keyboard are supported. For example, ASCII 8 (backspace) would work, but ASCII 25 (Substitution) would not.
On my linux system,
xev (used via
xev -event keyboard) shows the following data for media keys labeled as shown.
Excerpt from info displayed by xev Picture
keycode 180 (keysym 0x1008ff18, XF86HomePage) house
keycode 179 (keysym 0x1008ff81, XF86Tools) quarter-notes
keycode 163 (keysym 0x1008ff19, XF86Mail) envelope
keycode 172 (keysym 0x1008ff14, XF86AudioPlay) >/||
keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume) speaker
keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume) speaker
keycode 121 (keysym 0x1008ff12, XF86AudioMute) x'd-speaker
keycode 148 (keysym 0x1008ff1d, XF86Calculator) Calculator