7

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)
Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79
Ishant Sagar
  • 228
  • 5
  • 13

2 Answers2

14

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);
    }
 }
Satya
  • 151
  • 4
  • yah that work for me now look like its auto start in this exception need to more test for any side effect. – HiteshGs Dec 10 '20 at 11:38
0

The playback position may fall behind the live window, for example if the player is paused or buffering for a long enough period of time. If this happens This link will help you.

GvHarish
  • 340
  • 2
  • 13