androidx / androidx/media

Blocked UI when using large playlists

Open
#81 29 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Issue

We are experiencing UI lags when using big playlists containing podcast urls. Specifically, we are using a MediaController where we usesetMediaItems to pass around 600 MediaItems. The Items are presented in a RecyclerView where users can select the desired item. After selecting an item by click, we call MediaController#seekToDefaultPosition. This call clearly freezes the UI and also makes everything unresponsive for a few milliseconds. We have not checked if the problems also occurs with big playlists of local audio files.

Reproduce

We successfully reproduced the issue in your session demo project by slightly modifying the following line

https://github.com/androidx/media/blob/72a4fb082d9e68ecd7db3ff87b19f4232a5991d2/demos/session/src/main/java/androidx/media3/demo/session/PlayableFolderActivity.kt#L161

with

subItemMediaList.addAll(List(500) { children.get(0) })

As you can imagine, this code change only provokes a large playlist.

First select any audio file in the album, artist or genre folder. For example: Artist Folder -> The Kyoto Connection -> click on Intro - The Way ..

You should see the UI lag when you try to scroll in the list immediately after clicking an item in the bottom list view in the PlayerActivity.

We also found out that switching between two MediaItems which have been played before does not produces any lags. So maybe the UI issues are related to ongoing network calls.

For us, the UI lags are visible on the following phones, however, the bug is "better" visible on the Samsung S9:

  • Samsung S9 (Android 11)
  • OnePlus 6 (Android 11)

media3 Version: 1.0.0-alpha03

Please let us know if you have any further questions or if there is anything we can do to support you in finding the cause.
Thanks for building media3!

Julian

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.