Avoid audible glitch when clipping and re-concatenating a single audio source
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
It works perfect when play a single .m4a file with ProgressiveMediaSource. But it seems not sealmess when play the same audio file with ClippingMediaSource and ConcatenatingMediaSource. For example
```
val durations = longArrayOf(20100, 467, 11233, 7100, 6267, 10300)
var start = 0L
val audioFile = File(dir, "sample.m4a")
val audioSource = DefaultMediaSourceFactory(context)
.createMediaSource(MediaItem.fromUri(Uri.fromFile(audioFile)))
val concatAudioSource = ConcatenatingMediaSource(true)
for (i in 0 until durations.size) {
val durationUs = durations[i] * 1000
val end = start + durationUs
val clipAudio = ClippingMediaSource(audioSource, start, end)
concatAudioSource.addMediaSource(clipAudio)
start = end
}
_player?.run {
setMediaSource(concatAudioSource)
prepare()
}
```
then you will heard that an obvious pause(maybe glitch?, I'm not sure) between two period. It's easy to reproduce
Contributor guide
Assessment
This issue has not been assessed yet.