Skip to content

AudioEvent

1 min read

Import: import system.audio;

Read the audio guide for usage, limits, and current platform restrictions.

AudioEvent

Ordered player notifications. Timestamps are monotonic nanoseconds.

public enum AudioEvent

LoadStart

Loading began.

LoadStart(timestamp: long)

LoadedMetadata

Source metadata became available.

LoadedMetadata(timestamp: long)

CanPlay

Samples are available for playback.

CanPlay(timestamp: long)

Play

Playback was requested and pause state cleared.

Play(timestamp: long)

Playing

Output started or recovered from buffering.

Playing(timestamp: long)

Pause

Playback paused without changing position.

Pause(timestamp: long)

Seeking

A seek was accepted; position is the requested time in seconds.

Seeking(timestamp: long, position: double)

Seeked

A seek completed; position is the actual time in seconds.

Seeked(timestamp: long, position: double)

TimeUpdate

Playback position changed; emitted at most four times per second.

TimeUpdate(timestamp: long, position: double)

Waiting

Playback is waiting for source data.

Waiting(timestamp: long)

Ended

The source reached its natural end without looping.

Ended(timestamp: long)

VolumeChange

Volume or mute changed.

VolumeChange(timestamp: long)

DurationChange

The known duration changed.

DurationChange(timestamp: long)

Emptied

Previous source state was reset.

Emptied(timestamp: long)

Abort

Pending loading was cancelled.

Abort(timestamp: long)

Error

An operation failed; terminal marks a failure that stopped playback.

Error(timestamp: long, error: AudioError, operation: string, terminal: bool)

SinkChange

The selected output changed.

SinkChange(timestamp: long, sink_id: string)

DeviceLost

Output disappeared and playback paused.

DeviceLost(timestamp: long, error: AudioError)

Closed

Playback resources were released.

Closed(timestamp: long)

EventsLost

Queue overflow discarded count older events.

EventsLost(timestamp: long, count: int)