Unexpected audio track timestamp discontinuity
Which API doesn't behave as documented, and how does it misbehave? some mp3 URLs don't start playing automatically, instead, they pause for about 10 to 100 seconds in the beginning while showing an error message and then start playing
Minimal reproduction project these links cause the problem:
https://verse.mp3quran.net/arabic/nasser_alqatami/64/003001.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003002.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003003.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003004.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003005.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003006.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003007.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003008.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003009.mp3 https://verse.mp3quran.net/arabic/nasser_alqatami/64/003010.mp3
To Reproduce (i.e. user steps, not code) play the links provided using a playlist
Error messages
2021-08-19 21:48:46.284 com.******** E/MediaCodecAudioRenderer: Audio sink error
com.google.android.exoplayer2.audio.AudioSink$UnexpectedDiscontinuityException: Unexpected audio track timestamp discontinuity: expected 84762399, got 124179000
at com.google.android.exoplayer2.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:792)
at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:637)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1917)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:843)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:945)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:478)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:206)
at android.os.HandlerThread.run(HandlerThread.java:65)
Expected behavior to play normally
Screenshots N/A
Desktop (please complete the following information):
- OS: N/A
- Browser N/A
Smartphone (please complete the following information):
- Device: Lenovo K8 Note
- OS: Android 8.0.0
Flutter SDK version
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19043.1165], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Ultimate Edition (version 2020.1)
[√] VS Code, 64-bit edition (version 1.59.0)
[√] Connected device (3 available)
• No issues found!
Additional context
using audioplayers doesn't cause any problems
I can't reproduce the problem when I substitute in one of those URLs into the example (in example/lib/main.dart.
Can you confirm that this issue happens for you on the example in this repository substituting in your URL?
You actually may have more success reporting this upstream. just_audio depends on ExoPlayer which is provided by Google. Searching on the ExoPlayer issues page, there is a related issue where someone on the ExoPlayer team explained why this error happens and what it means:
https://github.com/google/ExoPlayer/issues/9131
This means that the audio timestamps provided in the FLAC content provided do not correspond to what the AudioSink is expecting.
In that case it was a FLAC file, but the error message should still indicate the same thing. It could either be a bug in ExoPlayer or it could be that the mp3 file contains invalid timestamps. Either way, if you share your MP3 file with the ExoPlayer team, they can investigate it at a lower level than I can, and if it is a bug, they will be able to fix it.
Can you confirm that this issue happens for you on the example in this repository substituting in your URL?
yes, i face the issue in the example while using this playlist:
final _playlist = ConcatenatingAudioSource(children: [
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003001.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003002.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003003.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003004.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003005.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003006.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003007.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003008.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003009.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003010.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003011.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003012.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003013.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003014.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003015.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003016.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003017.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003018.mp3")),
AudioSource.uri(Uri.parse("https://verse.mp3quran.net/arabic/nasser_alqatami/64/003019.mp3")),
]);
You actually may have more success reporting this upstream.
i did share URLs with them to investigate them via the email provided in the ExoPlayer's issue, i'll give feedback here if they reply;
one last question: doesn't audioplayers use ExoPlayer too? it plays without errors
@Mohammad-Adam did you managed to fix it, what was the problem?
@ulmas97 If you have encountered a similar issue, is it possible for you to share the URL of the audio that causes the issue?
@ryanheise The issue is only on IOS side, after playing the first file, the player pauses for some time and then it plays the second file.
_player.setAudioSource(
ConcatenatingAudioSource(
children: [
AudioSource.uri(
Uri.parse(
'https://alquran.qtlms.uz/media/file/oyat/MisharybinRashidAlafasyAasimHafsAasim/002008.mp3',
),
),
AudioSource.uri(
Uri.parse(
'https://alquran.qtlms.uz/media/file/oyat/MisharybinRashidAlafasyAasimHafsAasim/002009.mp3',
),
),
],
),
);
Oh, I'm sorry I thought you were reporting on the same issue (this issue is an Android issue). Perhaps you should open a new issue and provide all the details there.
@ryanheise Here is the new issue https://github.com/ryanheise/just_audio/issues/1046. Please take a look.