Giter Site home page Giter Site logo

Comments (4)

OxygenCobalt avatar OxygenCobalt commented on July 1, 2024 2

Could reproduce with a single-song queue. This seems like another thing I forgot to test with gapless playback. Thanks for reporting this.

from auxio.

unrenowned avatar unrenowned commented on July 1, 2024

I stumbled onto this bug while looking into #733. Not sure if you're already working on this @OxygenCobalt, but thought I'd mention it here anyway.

This bug doesn't just affect single-song queues. It occurs whenever you try to use "Play next" on the last song of a queue. I've put the (truncated) stracktrace you get when the crash happens below:

FATAL EXCEPTION: main
Process: org.oxycblt.auxio.debug, PID: 11379
java.lang.IllegalArgumentException
	at androidx.media3.common.util.Assertions.checkArgument(Assertions.java:40)
	at androidx.media3.exoplayer.ExoPlayerImpl.addMediaSources(ExoPlayerImpl.java:661)
	at androidx.media3.exoplayer.ExoPlayerImpl.addMediaItems(ExoPlayerImpl.java:637)
	at org.oxycblt.auxio.playback.system.PlaybackService.playNext(PlaybackService.kt:380)
...

From this, I think I can see the cause. When you run getNextMediaItemIndex() at the end of a playlist, you get back C.INDEX_UNSET (-1). This value fails the argument check in ExoPlayerImpl.addMediaSources():

checkArgument(index >= 0)

I'm pretty sure you can fix this with a check in PlaybackService.playNext(), something like this maybe?

val nextIndex = player.nextMediaItemIndex
if (nextIndex == C.INDEX_UNSET) {
    player.addMediaItems(songs.map { it.toMediaItem() })
} else {
    player.addMediaItems(nextIndex, songs.map { it.toMediaItem() })
}

If you want I can make a PR for this: just let me know which branch you want me to merge into as I think dev is a little behind on some shuffle order hotfixes.

from auxio.

OxygenCobalt avatar OxygenCobalt commented on July 1, 2024

You're probably right about this @unrenowned. Feel free to branch off hotfixes and make a patch PR, I'm super busy right now.

from auxio.

OxygenCobalt avatar OxygenCobalt commented on July 1, 2024

Resolved in #748. Will arrive in a hotfix release eventually.

from auxio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.