← Audio and media queue

Media.MediaError

luastra/media

Media.MediaError reports an admitted playback failure from the active host. Its code is stable for that reported failure, but the set of possible codes is host-specific rather than a portable SDK-wide enum.

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 this type after a media event reports a playback failure. Branch only on codes explicitly documented by the active host or target, show a safe message, and keep playback state recoverable.

Fields or definition

ParameterType / valuesDescription
codestringStable machine-readable code for this failure. The vocabulary is defined by the active host or target and may differ across hosts.
messagestringBounded human-readable diagnostic that must not be parsed for control flow.

Error codes

MediaError.code and message describe an admitted host playback failure. The code vocabulary is host-specific and intentionally not presented as one portable closed list; handle the visible message and preserve a safe playback state.

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 MediaError = { code: string, message: string }

Complete inventory

View all pages in Audio and media queue
← Previous: Media.QueueItemNext: Media.State →