Event
audio:start
ClientFired when an audio instance starts playing
Signal
"audio:start"Fires once per playback, not once per loop.
- Trigger — triggered by
self:playwhen the audio was not already playing, and byautoplayon a freshly created audio. - Already playing — calling
self:playon audio that is already playing restarts it silently and does not fire the signal. - Resuming — resuming from
self:set_pauseddoes not fire the signal, the playback never stopped. - Audio types — fires for both
core.audio_2dandcore.audio_3d. Useaudio:is_typeto tell them apart. - Detection — detected once per frame, so a play followed by a stop inside the same frame may not be reported.
Arguments
| Type | Name | Description |
|---|---|---|
core.audio_2d | core.audio_3d | audio | Audio instance that started playing |
Example
local entity = core.audio_2d.create("sounds/ambient.ogg")
util.event.on("audio:start", function(audio)
core.engine.print("info", "Audio started at:", audio:get_playback_position())
end)
entity:play()