PlayerEvent
Something that happened, as opposed to something that is.
The engine's session core emits these and KitePlayer.events carries them. The division of labour between this and PlayerSnapshot is strict, and it is the fix for the single most common mistake made against player APIs.
State goes in the snapshot. A snapshot conflates: a consumer that misses an intermediate value still ends up correct, because the latest value is the truth.
Occurrences go here, and only when missing one is harmless or when the occurrence itself is the information. Nothing a consumer must count is delivered as an event. Counters live in PlaybackStats instead, because a consumer can diff two snapshots and cannot recover a lost event.
libmpv publishes everything as events, coalesces them, and documents that one change event does not mean one change. Clients then write incremental logic that is subtly wrong and only fails on slow machines. This split makes that impossible to express.
Inheritors
Types
The audio output format changed, at the start or after a device change.
A chapter boundary was crossed.
Playback reached the end. Emitted once, before the status becomes Ended.
Playback stopped. The same error is on the snapshot.
The first frame of this media item left the schedule. latency is measured from the open.
A frame was presented. Emitted per frame only when PlayerConfig.frameEvents is on.
Playback crossed marker while advancing.
Loading finished and the first frame is ready. Carries the media that opened.
A seek finished and the target frame is ready. generation identifies which seek, so a consumer that issued several can tell which one completed.
The player changed which track of kind plays, on its own rather than because a caller asked; track is the one that plays now, or null for none.
The media gained tracks after it opened, and they are in the snapshot's tracks from now on (#509).
The video's size or pixel aspect changed, at the start or mid-stream. size is the picture as it is shown, after any crop its container states. See PictureCrop.
Something degraded and playback continued.