addListener

fun addListener(listener: KitePlayerListener, executor: Executor)

Calls listener on executor with the state, the progress, the events and the warnings, until removeListener. Adding a listener that is already added does nothing.

Each event that happens after this returns reaches the listener, and none from before it, because the player replays no event. Pass a serial executor, such as Android's main executor, for the calls of one method to arrive in order.

The events are taken from the player at once and queued for executor, so a listener whose executor is busy delays only itself, never the player or another listener. An exception a method throws is not caught: it reaches the executor's thread, and that listener gets nothing more.