← Audio and media queue

Media.DecodeSuccess

luastra/media

Media.DecodeSuccess represents the successful branch of a discriminated SDK result. Its value and success-specific fields are safe to read only after the shared success tag has narrowed the union.

Before you use it

Add luastra/media to this module's dependencies in luastra.json, then import it with require("luastra/media"). Declare media.command in luastra.json. Set an admitted queue before playback, start playback from an explicit user action where required, and implement both app.resolve and media_state handling.

How it fits

The type describes queue input, live playback state, or the tagged state-decoding result.

When to use it

Use Media.DecodeSuccess after narrowing the related result with success == true. Only this branch guarantees access to the decoded value and other success-specific fields.

Fields or definition

ParameterType / valuesDescription
successtrueDiscriminator that must be checked before reading branch-specific fields.
stateStateValidated typed media state available on the successful decode branch.
errornilBounded failure information, or nil on the successful branch.

SDK type flow

Produced by

Media.decodeState

What happens next

A checked media input/state/result annotation.

Failures and fixes

Missing capability, absent queue, invalid asset/content URI, autoplay policy, interruption, unsupported background behavior, or host failure must remain visible state. Do not optimistically treat command acknowledgement as playback success.

Availability

Public-source alpha API in 0.5.0-alpha; background playback and system controls require target-specific verification.

Exact declaration

export type DecodeSuccess = { success: true, state: State, error: nil }

Continue learning

Companions

Media.decodeState

Next steps

Media.DecodeResult

Complete inventory

View all pages in Audio and media queue
← Previous: Media.StateNext: Media.DecodeFailure →