Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exoplayer(2.0.0) giving BehindLiveWindowException when playing live HLS video

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)
like image 934
Ishant Sagar Avatar asked Sep 29 '16 12:09

Ishant Sagar


1 Answers

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);
    }
 }
like image 97
Satya Avatar answered Sep 25 '22 04:09

Satya