Skip to content

SimpleExoPlayer getDuration some audio links are getting incorrectly #6241

@zhan2046

Description

@zhan2046

[REQUIRED] Issue description

Hello, I found that using simpleExoPlayer.duration, In some audio links, the total duration of playback is incorrect.

For example, a song that takes a total of 2 minutes, but can only play for one minute.

[REQUIRED] Reproduction steps

Use https://pro-audio.xiaoheiban.cn/201907/0fd5f017-cafe-4dfd-9f69-3a06cf4e2651.wav audio link

val url = "https://pro-audio.xiaoheiban.cn/201907/0fd5f017-cafe-4dfd-9f69-3a06cf4e2651.wav"
val mediaMetadataCompat = MediaMetadataCompat.Builder()
    .putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, "METADATA_KEY_MEDIA_ID")
    .putString(MediaMetadataCompat.METADATA_KEY_TITLE, "METADATA_KEY_TITLE")
    .putString(MediaMetadataCompat.METADATA_KEY_MEDIA_URI, url)
    .build()
mediaMetadataCompat.description.extras?.putAll(mediaMetadataCompat.bundle)
val extractorMediaSource = ExtractorMediaSource.Factory(factory)
        .setTag(mediaMetadataCompat.description)
        .createMediaSource(Uri.parse(url))
val concatenatingMediaSource = ConcatenatingMediaSource()
concatenatingMediaSource.addMediaSource(extractorMediaSource)
simpleExoPlayer.prepare(concatenatingMediaSource)
simpleExoPlayer.seekTo(0, 0)

When the music is playing, the total length of the music is found to be wrong.

val duration = simpleExoPlayer.duration

[REQUIRED] Version of ExoPlayer being used

com.google.android.exoplayer:exoplayer:2.10.3
com.google.android.exoplayer:exoplayer-ui:2.10.3
com.google.android.exoplayer:extension-mediasession:2.10.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions