Reputation: 49
My live window is approximately 10 minutes, my buffer is about 30 seconds. If I pause the stream for longer than 10 minutes then resume, the player will play the buffered data for ~30 secs before throwing a BehindLiveWindowException
.
Instead, is there a way to anticipate ahead of the buffer for a possible BehindLiveWindowException
so that we can receive the error straight away? I've tried looking online but there's very little on this topic.
Upvotes: 0
Views: 765
Reputation: 49
override fun onTimelineChanged(timeline: Timeline, reason: Int) {
if (timeline.isEmpty) {
earliestLiveWindowTime = LIVE_WINDOW_UNSET
return
}
val window = timeline.getWindow(0, timelineWindow, 0)
earliestLiveWindowTime = window.windowStartTimeMs
}
Regarding the above code, earliestLiveWindowTime
will be the earliest time available of the live window. When resuming after having paused for a while, if the player position is a lower value than this earliestLiveWindowTime
value, we know that we're behind the live window so can throw a BehindLiveWindowException
at this point.
Upvotes: 2