ExoPlayer: BehindLiveWindowException when playing HLS
With latest ExoPlayer library, when playing HLS, sometimes the video hang with BehindLiveWindowException:
E/ExoPlayerImplInternal: Internal track renderer error.
com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.BehindLiveWindowException
at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:154)
at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:141)
at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:438)
at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:213)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:168)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
Caused by: com.google.android.exoplayer.BehindLiveWindowException
at com.google.android.exoplayer.hls.HlsChunkSource.getChunkOperation(HlsChunkSource.java:290)
at com.google.android.exoplayer.hls.HlsSampleSource.maybeStartLoading(HlsSampleSource.java:541)
at com.google.android.exoplayer.hls.HlsSampleSource.continueBuffering(HlsSampleSource.java:253)
at com.google.android.exoplayer.SampleSourceTrackRenderer.continueBufferingSource(SampleSourceTrackRenderer.java:173)
at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:462)
at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:431)
at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:213)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:168)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
But if I just wait for about 3 - 5 seconds (or call preparePlayer() again) then the video starts playing again with no problem. Sometimes there’s also SocketTimeoutException of okhttp before this exception, I tried to increase timeout in DefaultHttpDataSource and SocketTimeoutException is gone but this exception persists.
So how to get rid of this? Maybe it’s because of slow network connection, is there any way to increase timeout other than in DefaultHttpDataSource?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 37 (13 by maintainers)
Note that Apple’s documentation on using HTTP live streaming has 3 segments in it https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html
I hardly think this is a content problem
@huykn , in this case you loose ability to dynamically select variant base on network conditions and you have to control from your client side which variant select in order to provide best user experience. In other words, if the network quality is low you have to detect it by yourself and switch stream into lower variant, otherwise buffering will be more and more frequent and end user experience of your application will be unpredicted. Keep this in mind.