How To Call It
System is a global table: call its functions with a dot (System.<method>(...)), not a colon. Requires Macro Handler 1.0.62 or later.
Dispatches a media-button down/up pair to Android’s current media target. True means dispatch completed, not that playback succeeded.
Documented for app version 1.0.64Updated:
System is a global table: call its functions with a dot (System.<method>(...)), not a colon. Requires Macro Handler 1.0.62 or later.
In system flow, design steps as observe first and act second when the API can affect device state.
command: play, pause, play_pause, stop, next, previous. Invalid types/values or rejected dispatch return false; invalid commands have no side effects.
Does not select a package or player; it uses Android media-key routing. If no media consumer exists, true does not prove that sound started. It dispatches to the current session and is distinct from System.playMedia, which opens media.
No-Code or Logic: System → Android Actions → Media control. Lua equivalent: Automation.action("media_control", {command="pause"}); failed dispatch raises an error in that higher-level API.
The snippet below is a starter pattern that can be applied directly in runtime flow.
local dispatched = System.mediaControl("pause")
print("Media request dispatched", dispatched)From foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
local dispatched = System.mediaControl("pause")
print("Media request dispatched", dispatched)local stepOk = true
local dispatched = System.mediaControl("pause")
print("Media request dispatched", dispatched)
if stepOk then
wait(200)
endlocal ok, err = pcall(function()
local dispatched = System.mediaControl("pause")
print("Media request dispatched", dispatched)
end)
if not ok then
print("API step failed: System.mediaControl: " .. tostring(err))
requestStop()
end-- In system flow, design steps as observe first and act second when the API can affect device state.
local function run_mediacontrol_step()
local dispatched = System.mediaControl("pause")
print("Media request dispatched", dispatched)
end
local ok, err = pcall(run_mediacontrol_step)
if not ok then
toast("Step failed")
print(err)
endlocal dispatched = System.mediaControl("pause")
if not dispatched then error("Media request was not dispatched") end