ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Getting java.io.EOFException while streaming from a HLS media

Open pratikjk opened this issue 9 years ago • 3 comments

  • Trying to stream from a HLS media. The audio and video renderers work fine but setting up a text renderer causes the exceptions and not playing of the stream with subtitles -http://ajo.dev.reuters.tv/rest/v2/xato/playlist/assets/139287,140784,140847,140800,57445,127691,140785,127679,140855,127800,140799,127770,140803,139291/video.m3u8 is the link I am trying to stream from. This fails to render the subtitles our app as well as on the demo app. However tried in QuickPlayer where it works perfectly fine with the subtitles.
  • I am using ExoPlayer 1.5.9
  • In my app I am getting
E/ExoPlayerImplInternal: Internal track renderer error.
                                                                          com.google.android.exoplayer.ExoPlaybackException: java.io.EOFException
                                                                              at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:263)
                                                                              at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:149)
                                                                              at com.google.android.exoplayer.ExoPlayerImplInternal.incrementalPrepareInternal(ExoPlayerImplInternal.java:275)
                                                                              at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:205)
                                                                              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.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
                                                                           Caused by: java.io.EOFException
                                                                              at com.google.android.exoplayer.extractor.DefaultExtractorInput.readFromDataSource(DefaultExtractorInput.java:245)
                                                                              at com.google.android.exoplayer.extractor.DefaultExtractorInput.readFully(DefaultExtractorInput.java:67)
                                                                              at com.google.android.exoplayer.extractor.ts.TsExtractor.read(TsExtractor.java:134)
                                                                              at com.google.android.exoplayer.hls.HlsExtractorWrapper.read(HlsExtractorWrapper.java:249)
                                                                              at com.google.android.exoplayer.hls.TsChunk.load(TsChunk.java:115)
                                                                              at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:209)
                                                                              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
                                                                              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                              at java.lang.Thread.run(Thread.java:818)

While in the ExoPlayer Demo app, doesnt show any subtitles despite enabling it.

Looking the exception, seems to me that ExoPlayer is trying to use TsExtractor but the subtitles are in WebVtt format

WEBVTT X-TIMESTAMP-MAP=MPEGTS:900000,LOCAL:00:00:00.000 1 00:00:01.000 --> 00:00:05.000 line:-3 Captioning in progress...

pratikjk avatar Jan 21 '17 23:01 pratikjk

This is a duplicate of #2025. The quickest way to fix this is adding a .vtt extension to each media segment. We will also provide a fix for this for Webvtt tracks soon.

AquilesCanta avatar Jan 23 '17 14:01 AquilesCanta

@AquilesCanta thanks for the response. The media we are trying to play is external to us and won't be possible to ask the provider to update their extension for each media segment. Is there any easy fix that can be patched in ExoPlayer?

pratikjk avatar Jan 23 '17 16:01 pratikjk

My best advice, if you can't modify the stream(by the way, this should be trivial for the producers), is to switch to Exoplayer V2. A fix will be available in the next push, as it's already available internally. If you can't wait until next push, in HlsMediaChunk (r2.1.1) you should change the

if (lastPathSegment.endsWith(WEBVTT_FILE_EXTENSION) || lastPathSegment.endsWith(VTT_FILE_EXTENSION)) {

condition in buildExtractorByExtension to

if (MimeTypes.TEXT_VTT.equals(hlsUrl.format.sampleMimeType) || lastPathSegment.endsWith(WEBVTT_FILE_EXTENSION) || lastPathSegment.endsWith(VTT_FILE_EXTENSION))

This is for the last V2 available subversion. If you don't want to migrate to V2 you'll have to work out an equivalent solution, since we have not decided whether we are going to backport this. At this point, we only backport straightforward bugfixes. Unfortunately, this is not the case here. I will write back to let you know what the plan is, or close should we decide not to backport the fix.

AquilesCanta avatar Jan 23 '17 17:01 AquilesCanta