这是indexloc提供的服务,不要输入任何密码
Skip to content

ExoPlayer.moveMediaItems does not update the shuffle order (Copy) #1381

@OxygenCobalt

Description

@OxygenCobalt

Version

Media3 main branch

More version details

(This is a reposted issue since the last one was locked for inactivity. I've only recently realized that this issue was not my fault.)

Media3 1.3.1

Devices that reproduce the issue

All

Devices that do not reproduce the issue

N/A

Reproducible in the demo app?

Yes

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 [dummy2, dummy3, dummy1].
  • Reindex the shuffle order, resulting in a shuffled index list of [2, 1, 0].
  • Move the items in the shuffle order, resulting in a shuffled index list of [1, 0, 2] and a shuffled playlist of [dummy3, dummy2, 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

  • 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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions