onHlsStateChanged

open fun onHlsStateChanged(state: HLSState, hlsUrl: HLSUrl?)

Called at every step of the HLS lifecycle, once per state. Room.hlsState holds the latest state.

HLSState.HLS_STARTED only means the server accepted the request — the playlist is not fetchable yet. Wait for HLSState.HLS_PLAYABLE, which carries the URLs.

Code Example:

override fun onHlsStateChanged(state: HLSState, hlsUrl: HLSUrl?) {
if (state == HLSState.HLS_PLAYABLE) hlsUrl?.playbackHlsUrl?.let(player::play)
}

Parameters

state

the new state; a state this SDK version does not know is not delivered.

hlsUrl

the playback URLs with HLSState.HLS_PLAYABLE; null with every other state, and with HLS_PLAYABLE only if the server sent no URL.