KotlinAudio icon indicating copy to clipboard operation
KotlinAudio copied to clipboard

feat: crossfade

Open lovegaoshi opened this issue 1 year ago • 0 comments

this PR is WIP; code quality is quite bad but I need advice on how to properly implement this. Functionality-wise it seems to work.

while exoplayer does not natively support crossfade/gapless playback, crossfade can be achieved by rotating 2 exoplayers on track switching. I initialized 2 exoplayers in BaseAudioPlayer and made fun switchExoplayer that rotates exoplayer to NotificationManager, and added volume fade. The 2 exoplayers have synchronous queues and queue positions, so seekToNextMediaItem/Previous will work as intended.

MainAcitivity has a refresh button that plays the next track with crossfade for the demo.

lovegaoshi avatar Sep 10 '23 13:09 lovegaoshi