Open allenxu-passion opened 3 weeks ago
I use CacheDataSource because I need to implement download functionality.
Hi @allenxu-passion,
Thanks for reporting! Just want to get problem clarified - does the player stop when playing the downloaded media or when playing from the upstream?
@tianyif Thanks for attention. The problem occurs when these two situations (downloaded and upstream) occur at the same time. I tried to simulate the situation where the url become invalid:
When debugging, I sometimes get the following log, I'm not sure if it's related.
E Audio sink error androidx.media3.exoplayer.audio.AudioSink$UnexpectedDiscontinuityException: Unexpected audio track timestamp discontinuity: expected 1000123379500, got 1000125248707
at androidx.media3.exoplayer.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:994)
at androidx.media3.exoplayer.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:744)
at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:2010)
at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:827)
at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1112)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:544)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
Thanks and expect a reply.
I use media3 exoplayer to develop a music playback APP. Since the audio URL will become invalid, I need to request a new URL and replace it after it expires.
As follows
When the url is invalid, replace it with a new url through ResolvingDataSource. But there is a problem. When the URL is replaced, the player will stop playing after a while.
There's no obvious error logs. In DefaultHttpDataSource, the open(DataSpec dataSpec) method is executed and the connection is established. I guess CacheDataSource did a check and found that the two URLs were different or the container meta information was different, so it stopped. I'm not sure.
Is there a solution?