androidx / androidx/media

Add support to remove multiple media items at given list of indices

Open
#1,091 0 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Feb 16, 2024.

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

Description

UseCase

Currently mediaBrowser.removeMediaItems takes index or range of indices to remove items from mediaBrowser queue. I have a local Audio Player application, in which there is a scenario to remove multiple items from the queue, which may be 100+ items and their indices may or may not be in consecutive sequence. So I need to remove them 1 by 1. Running this on mainThread takes too much time and causes an ANR in my app.

Tried Solution

I tried to filter the list and separate out the indices and range from the list and remove range wherever possible. But still if a list of indices has no adjacent values in it, I have to iterate through the whole list 1 by 1.

Proposed Solution

I'm proposing a solution to add a new method, that could take a list of indices List<Int> and remove all the required items in a single go.

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.