Skip to content

Some audio files (MP3) can not be played correctly #5772

Closed
@Furystorm

Description

[REQUIRED] Content description

I am using ExoPlayer demo app to play audio, some "bad" mp3 file can not be played correctly. Some can not play any sound, some can play but will interrupt with error during playing, and/or the duration time is not correct. These files are badly truncated, I guess, or somehow malformed.

An EOFException was thrown, fitting with "having read at least one byte, but fewer than length" case in the doc.

com.google.android.exoplayer2.demo E/EventLogger: internalError [0.55, -0.02, window=0, period=0, loadError]
    java.io.EOFException
        at com.google.android.exoplayer2.extractor.DefaultExtractorInput.readFromDataSource(DefaultExtractorInput.java:265)
        at com.google.android.exoplayer2.extractor.DefaultExtractorInput.advancePeekPosition(DefaultExtractorInput.java:135)
        at com.google.android.exoplayer2.extractor.DefaultExtractorInput.peekFully(DefaultExtractorInput.java:116)
        at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.peekEndOfStreamOrHeader(Mp3Extractor.java:345)
        at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.readSample(Mp3Extractor.java:226)
        at com.google.android.exoplayer2.extractor.mp3.Mp3Extractor.read(Mp3Extractor.java:218)
        at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:898)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:784)

In my app, I tried to change the playback speed, and it does change. e.g. for the examples audio below, the first audio can play with 0.6 speed, and the second audio can not play with 1.4 speed.

But other players can play these files well, so how could I play these files with exoplayer, or is there any workaround?

[REQUIRED] Link to test content

[
  {
    "name": "bad mp3 files",
    "samples": [
      {
        "name": "can_not_play",
        "uri": "https://res.5ideachinese.com/voice/2019/04/2854674ddcfd73019d8bbdf556f3ed2a.mp3"
      },
      {
        "name": "play_with_error_and_duration_not_correct",
        "uri": "https://res.5ideachinese.com/voice/2019/04/7e40e4622b7c067626ce4c721c29f4d0.mp3"
      }
    ]
  }
]

[REQUIRED] Version of ExoPlayer being used

r2.9.6

[REQUIRED] Device(s) and version(s) of Android being used

We met this issue in different kinds of versions and devices, perhaps, it has nothing do with the versions or devices.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions