media Key

Emulate a press of a media key on a keyboard.

keyboard mediamutepress
JavaScript
function keyboard.mediaKey(key: KeyboardMediaKey, event: KeyboardKeyEvent): void;
Python
def keyboard.media_key(key: KeyboardMediaKey, event: KeyboardKeyEvent): None

The Arcade needs a connection to a computer or other host device with a USB cable in order to emulate keyboard actions. This function doesn’t work in the simulator.

Media keys are special keys found on many keyboards to do special actions with applications. Some examples are to turn sound volume up or open a web search window.

Parameters

  • key: a keyboard media key. The key choices are in the key list of the block or part or the KeyboardMediaKey enumeration.
  • event: the key press event to simulate. These are:
    • press: simulate a media key press down and then release up
    • down: simulate a media key press down
    • up: simulate a media key release up

Example

Emulate typing a command to open this page in the web browser.

"https://arcade.makecode.com/reference/keyboard/m…"keyboard typekeyboard mediaweb homepresson start

See also

type, key, function key