resolveLiveStreamPlayerState

fun resolveLiveStreamPlayerState(stream: LiveStream?, playableUrl: String?, trailerUrl: String?, nowEpochMs: Long, posterUrl: String? = null): LiveStreamPlayerState(source)

Resolves the display state for a live stream.

Parameters

stream

the latest live-stream snapshot from the server. null means we haven't fetched anything yet — caller should render LiveStreamPlayerState.Loading.

playableUrl

best HLS URL we could resolve for this stream (videoPlaylistUrl > fallbackUrl > playbackUrlHls). null if we couldn't get one. Live and VOD both come through this same field — Bunny's play-data endpoint returns the correct URL based on the stream's current status.

trailerUrl

resolved HLS URL of the pre-stream trailer video, if any. null while it's being fetched or if there's no trailer configured. The resolver only uses this when the stream is in a pre-start state with preStreamTrailerVideoId set; in any other case trailerUrl is ignored.

nowEpochMs

current wall-clock time, passed in so tests can pin it.

posterUrl

the stream's thumbnail URL (from play-data), used only as the blurred background behind the countdown overlay so the look matches the web player. Ignored for every non-countdown state.