Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExoPlayer.moveMediaItems does not update the shuffle order #954

Closed
1 task
OxygenCobalt opened this issue Jan 9, 2024 · 2 comments
Closed
1 task

ExoPlayer.moveMediaItems does not update the shuffle order #954

OxygenCobalt opened this issue Jan 9, 2024 · 2 comments
Assignees
Labels

Comments

@OxygenCobalt
Copy link
Contributor

OxygenCobalt commented Jan 9, 2024

Version

Media3 1.2.0

More version details

No response

Devices that reproduce the issue

All

Devices that do not reproduce the issue

N/A

Reproducible in the demo app?

Unsure. Is there a part of the demo where you have a fully manipulable queue?

Reproduction steps

Occurs at any queue move in a shuffled playlist that does not happen to result in the indended shuffled playlist (It's hard to define the specific criteria, sorry). For example, this pseudo-kotlin code:

player.shuffleModeEnabled = true
player.setMediaItems(listOf(dummy1, dummy2, dummy3)) // Assume these are initialized MediaItems
player.moveMediaItems(0, 2) 

Expected result

Assume that the shuffled playlist is: [dummy1, dummy3, dummy2] (i.e shuffled index list of [0, 2, 1]), and the ordered playlist [dummy1, dummy2, dummy3].

Moving the media items as specified in the reproduction steps should as a result:

  • Move the ordered playlist, resulting in [dummy3, dummy2, dummy1].
  • Reindex the shuffle order, resulting in a shuffled index list of [2, 0, 1].
  • Move the items in the shuffle order, resulting in a shuffled index list of [1, 0, 2] and a shuffled playlist of [dummy2, dummy3, dummy1]

In practice, this should involve another ShuffleOrder override, something like cloneAndMove, that performs this reindexing and item moving.

Actual result

The ShuffleOrder is not even cloned when MediaItems are moved judging by ExoPlayerImpl. Instead, what happens is:

  • Move the ordered playlist, resulting in [dummy3, dummy2, dummy1].
  • Do not reindex the shuffle order, resulting in still a shuffled index list of [0, 2, 1]
  • Do not move anything in the shuffle order, resulting in a shuffled index list of [0, 2, 1] and a shuffled playlist of [dummy3, dummy1, dummy2]. This is entirely incorrect.

Media

N/A

Bug Report

@OxygenCobalt OxygenCobalt changed the title [ShuffleOrder] ExoPlayer.moveMediaItems does not update the shuffle order ExoPlayer.moveMediaItems does not update the shuffle order Jan 9, 2024
@OxygenCobalt
Copy link
Contributor Author

I am willing to make a PR for this as long as I know exactly where to start and what to look out for.

@OxygenCobalt
Copy link
Contributor Author

Update: I was mis-interpreting an issue on my end as a library issue. I wasn't correctly using moveMediaItems to obtain the "swapping" behavior I was looking for. The shuffle order seems to behave normally when I do that.

@androidx androidx locked and limited conversation to collaborators Mar 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants