Keyboard Media
About
With theย Media Keyboard you gain control over volume and music playback on your phone, compatible with various platforms including Spotify, Apple Music, and YouTube. Furthermore, certain apps can detect volume up/down key presses, ensuring compatibility. For example, SB Mote and selfie remotes send volume-up signals, so apps supporting them should be compatible with this keyboard, too.
The code:
const mapping = [
null, '#VOL_UP', null,
'#PREV', '#PLAY_PAUSE', '#NEXT',
null, '#VOL_DOWN', null,
null, '#MUTE', null,
];
function onAtomButtonClick(keyCode, count) {
const key = mapping[keyCode];
if (!key) return;
keyboard.send(key);
}
function onEvent(e) {
if (e.source !== 'atom:button') return;
const buttonId = parseInt(e.value);
if (e.type === 'click' || e.type === 'longpress' || e.type === 'repeatpress') {
return onAtomButtonClick(buttonId);
}
if (strSub(e.type, 0, 5) === 'click' && strLen(e.type) === 6) {
const clickCount = parseInt(strCharAt(e.type, 5));
for (let i = 0; i < clickCount; i++) {
onAtomButtonClick(buttonId);
}
}
}
General
๐ย First Steps
MagiScript Editor
๐ย Basics
๐ย Running Your First Program
๐ย App Store
๐ย Atom Settings (Editor)
๐ย Debugging Techniques
Examples
๐ย Atom Time
๐๏ธ Time Practice
๐ย Atom Pi (Pi Revelations)
๐ย Atom Drum
๐๏ธ Atom Stack
๐ย Atom Square
๐ย Atom Level
๐ย Atom THMPR
๐ย Poker Hands
๐ย Keyboard Numeric
๐ย Keyboard NOKIA
๐ย Keyboard Cursor
๐ย Keyboard Media
๐ย Keyboard Custom
Input/Output
๐ย Buttons
๐ย Vibration Motor
๐ย RGB LED
๐ย Devices
๐ย PeekSmith
๐ย SB Watch
๐ย Bluetooth Keyboard
๐ย Bluetooth Mouse
๐ย Timers
๐ย Database
๐ย Events
๐ย System (exit, sleep, rand)
๐ย Objects (card, time)
Language
๐ย Summary
๐ย Comments
๐ย Variable Declarations
๐ย Operators
๐ย Control Flow
๐ย Functions
๐ย Numbers
๐ย Strings
๐ย Arrays
๐ย Objects
๐ย Uint8Array