Recipe: play packaged audio

luastra/media · live media_state events · about 20 minutes

Load one packaged WAV file, control playback, and render only decoded host state without polling or an application-owned progress loop.

You will copy one audio fixture, install it as a one-item queue at launch, and expose Play and Pause controls whose enabled state follows the host.

Media commands return RequestId values and complete in app.resolve. Ongoing playback truth arrives as media_state events in app.handle; both payload paths use Media.decodeState.

A successful Media.play completion is not permission to invent playing state. Decode host state and let media_state remain authoritative as playback changes.

Detail pages

1. Create the project and copy audio2. Replace luastra.json3. Replace src/main.luau4. Replace tests/smoke.luau5. Check and run6. Separate command completion from live truth7. Understand sources and queues8. Keep host claims evidence-bound