OnTtsPlaybackStateChange

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 23:50, 10 October 2026 by QCherry (talk | contribs) (Release 0.1.7 / BUILD199 / Protocol 39: current API availability, setup and improvements)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

onTtsPlaybackStateChange

AVAILABLE SINCE UPDATE 0.1.7
This event is available since G1R:MP 0.1.7.

Reports significant playback/preload lifecycle events.

Availability

This event is available in server scripts.

Callback signature

function(id, info)

Parameters

Name Type Description
id number Resource-owned playback/preload ID.
info table playback=true, id, state. States emitted: playing, stopped, finished, preloaded, preload-timeout, no-listener-ready. playing schedules a common start; terminal notifications invalidate the handle. Pause/volume/position changes do not each emit this event.

Examples

addEventHandler("onTtsPlaybackStateChange", resourceRoot, function(id, info)
    outputDebugString("TTS " .. id .. ": " .. tostring(info.state))
end)

Notes

  • Available since 0.1.7.
  • Register with addEventHandler on resourceRoot before submitting requests. Delivered only to the owning server resource; info is a Lua table, not JSON text.
  • See Server TTS for complete lifecycle examples and cleanup. Stopping the resource cleans up its work/audio; no callbacks are promised after its VM stops.