← Recipe: play packaged audio

7. Understand sources and queues

luastra/media · live media_state events · about 20 minutes
asset: for packaged files · content: for scoped grants

Media accepts admitted sources and a bounded queue rather than arbitrary filesystem or network URLs.

When to use it

Read this before adding another track, protected content, Next and Previous controls, or seeking.

  • Use Assets.audio and Assets.uri for files declared in luastra.json.
  • Use content grants issued by a trusted backend for protected media; a content: token is not a public URL.
  • Raw https://, file://, absolute paths, data URLs, and short forged content tokens are rejected.
  • A queue contains 1 to 32 items. selectedIndex is one-based in Luau even though decoded queueIndex is zero-based.
  • Enable Next, Previous, and Seek from decoded queue and duration fields, not from assumptions about the source.

Complete inventory

View all pages in Recipe: play packaged audio
← Previous: 6. Separate command completion from live truthNext: 8. Keep host claims evidence-bound →