Audio and media queue
luastra/mediaControls a bounded audio queue through asynchronous commands and reports live playback through typed media-state events. Queue selection, command acknowledgement, and actual playback state remain separate so web and native hosts can implement the same contract.
Set a stable queue, issue commands from explicit user or lifecycle actions, and render controls from Media.decodeState output rather than optimistic assumptions.
Background playback, hardware controls, and packaging are host evidence boundaries; verify them on each claimed target before release.
Complete example
local Assets = require("luastra/assets")
local Media = require("luastra/media")
Media.setQueue({
{
id = "focus",
source = Assets.uri(Assets.audio("audio/focus")),
title = "Focus",
artist = "Luastra",
},
})
Media.play()
-- Decode every media_state payload before updating controls.
local result = Media.decodeState(payload)
if result.success then
playbackState = result.state
end