我在播放实时视频(HLS)一段时间后收到此异常,对于录制的视频,它工作正常。
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)
答案 0 :(得分:9)
根据Google Ver 2.0,Live HLS游戏非常不稳定。所以我不建议现在切换到2.0用于Live HLS播放。 来到您的问题BehindLiveWindowException,Google仍在努力解决此问题,作为Live HLS搜索功能的一部分。
请在此处跟踪状态: https://github.com/google/ExoPlayer/issues/1782
作为临时修复,您可以在onError()中再次调用preparePlayer()。
@Ovierride
public void onError(Exception e) {
if (e instanceof ExoPlaybackException
&& e.getCause() instanceof BehindLiveWindowException) {
preparePlayer(true);
}
}