1

I am writing an Android application that plays a large MP3 file over the web. These files are usually about an hour or so and I've been getting some really inconsistent behavior with the stream cutting off in the middle in some cases.

To fix this, I decided to move to ExoPlayer and utilize an HLS implementation. While I am able to play the Apple test files (the beep boop) without issue, I can't seem to get any of my own streams to work.

Whenever I try to access my own stream, the player errors out and I get the following stack trace:

06-05 18:15:22.898  29566-29566/com.application E/EventLogger﹕ internalError [0.66, loadError]
    java.io.EOFException
            at com.google.android.exoplayer.extractor.DefaultExtractorInput.readFully(DefaultExtractorInput.java:73)
            at com.google.android.exoplayer.extractor.ts.TsExtractor.read(TsExtractor.java:102)
            at com.google.android.exoplayer.hls.HlsExtractorWrapper.read(HlsExtractorWrapper.java:214)
            at com.google.android.exoplayer.hls.TsChunk.load(TsChunk.java:110)
            at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:242)

What is the correct way to create an HLS Stream from an MP3 for Android? For testing, I have tried a number of ffmpeg exports and am using S3 to serve the files, but I have been unsuccessful.

One of the samples can be found here: https://s3.amazonaws.com/gte619n/test_stream/output_test.m3u8

Thank you for all your help and suggestions.

Evan Ruff
  • 582
  • 7
  • 21

1 Answers1

1

Your link works fine in the ExoPlayer currently available at GitHub.

How to do it:

1) git clone https://github.com/google/ExoPlayer.git

2) Open the ExoPlayer/demo app in Android Studio

3) Edit ExoPlayer/demo/src/main/java/com/google/android/exoplayer/demo/Samples.java and add

  public static final Sample[] HLS = new Sample[] {
    new Sample("Stackoverflow",
            "https://s3.amazonaws.com/gte619n/test_stream/output_test.m3u8",
            PlayerActivity.TYPE_HLS),

and it worked.

Jacob Nordfalk
  • 3,533
  • 1
  • 21
  • 21
  • Hey Jacob, it turned out that the issue was related to the specific formatting of the HLS file, namely the spaces in the file. I believe this was fixed ina recent version. Thanks for your help! – Evan Ruff Sep 30 '15 at 15:30