I am getting this exception after some time when I am playing a live video(HLS), for recorded videos it is working fine.
com.google.android.exoplayer2.source.BehindLiveWindowException
at com.google.android.exoplayer2.source.hls.HlsChunkSource.getNextChunk(HlsChunkSource.java:255)
at com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper.continueLoading(HlsSampleStreamWrapper.java:313)
at com.google.android.exoplayer2.source.CompositeSequenceableLoader.continueLoading(CompositeSequenceableLoader.java:55)
at com.google.android.exoplayer2.source.hls.HlsMediaPeriod.continueLoading(HlsMediaPeriod.java:198)
at com.google.android.exoplayer2.ExoPlayerImplInternal.maybeContinueLoading(ExoPlayerImplInternal.java:1080)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleContinueLoadingRequested(ExoPlayerImplInternal.java:1067)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:289)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer2.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
As per Google ver 2.0 is very unstable for Live HLS play. So i don't recommend as of now switching to 2.0 for Live HLS play. Coming to your issue BehindLiveWindowException, Google still working to fix this issue as a part of Live HLS seek functionality.
Please track the status here: https://github.com/google/ExoPlayer/issues/1782
As a temporary fix u can call preparePlayer() again in onError().
@Ovierride
public void onError(Exception e) {
if (e instanceof ExoPlaybackException
&& e.getCause() instanceof BehindLiveWindowException) {
preparePlayer(true);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With